package com.app.service;

import com.alibaba.fastjson.JSON;
import com.app.domain.UploadParameter;
import com.app.domain.YjData;
import com.app.domain.cleb.GroutingInfo;
import com.app.domain.cleb.GroutingResult;
import com.app.domain.cleb.GroutingSteel;
import com.app.domain.cleb.ResultJson;
import com.app.domain.dygs.*;
import com.app.domain.gd.YfResponseResult;
import com.app.domain.gd.YfYjData;
import com.app.domain.gd.YfYjInfo;
import com.app.domain.gd.YfYjRealData;
import com.app.domain.hsy.ResponseResult;
import com.app.domain.hsy.Yjsy_M;
import com.app.domain.hsy.Yjsy_S;
import com.app.domain.hsy.Yjsy_S_S;
import com.app.domain.ihyfb.IhyfbResponseResult;
import com.app.domain.ihyfb.LHmudjack;
import com.app.domain.ihyfb.MudjackCurveGraph;
import com.app.domain.ihyfb.TokenResponseResult;
import com.app.domain.jwjb.*;
import com.app.domain.ldpf.YjSingle;
import com.app.domain.lhgs.*;
import com.app.domain.scsb.Grouting;
import com.app.domain.scsb.Process;
import com.app.domain.scsb.ScsbResultJson;
import com.app.domain.shhy.*;
import com.app.domain.wl.WlResult;
import com.app.domain.wl.WlYjData;
import com.app.domain.wxgd.WxgdData;
import com.app.domain.wxgd.WxgdResponseResult;
import com.app.domain.wxjjlb.CompressSlurryResult;
import com.app.domain.ycgs.MudjackData;
import com.app.domain.ycgs.MudjackDataList;
import com.app.domain.ycgs.YcResult;
import com.app.domain.yxtj.*;
import com.app.domain.zmqb.ZmqbData;
import com.app.domain.zmqb.ZmqbDataList;
import com.app.domain.zmqb.ZmqbDetail;
import com.app.domain.zmqb.ZmqbResult;
import com.app.utils.HttpClients;
import com.app.utils.MathUtil;
import com.app.utils.StringUtil;
import com.app.utils.TimeHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sun.misc.BASE64Encoder;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Slf4j
@Service
@Transactional
public class UploadService {
    @Autowired
    UploadParameterService uploadParameterService;
    @Autowired
    YjDataService yjDataService;


    public SaveDataResult sendJwjbMessage(String access_token, String type, String json, String url) {
        SaveDataResult saveDataResult = null;
        Map<String, String> map = new HashMap<>();
        map.put("access_token", access_token);
        map.put("type", type);
        map.put("data", json);
        try {
            String result = HttpClients.requestPost(url, map);
            log.info("llbbresult:" + result);
//            System.out.println(result);
            saveDataResult = (SaveDataResult) JSON.parseObject(StringUtil.replaceBlank(result), SaveDataResult.class);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return saveDataResult;
    }

    public RefreshTokenResult sendJwjbTokenMessage(String url) {
        RefreshTokenResult refreshTokenResult = null;
        try {
            String result = HttpClients.requestTokenPost(url);
            refreshTokenResult = (RefreshTokenResult) JSON.parseObject(StringUtil.replaceBlank(result), RefreshTokenResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return refreshTokenResult;
    }

    public <T> ResponseResult sendHsyMessage(String busiType, String serviceUrl, List<T> busiData) {
        Map<String, Object> requestMap = new HashMap();
        requestMap.put("Method", busiType);
        requestMap.put("data", busiData);
        String requestJson = JSON.toJSONString(requestMap);
        ResponseResult responseResult = null;
        try {
            byte[] bytes = requestJson.getBytes("utf-8");
            String base64Str = new BASE64Encoder().encode(bytes);
            String result = HttpClients.requestPost(serviceUrl, base64Str);

            /*    saveSendMessage(busiType, requestJson, result);*/
            responseResult = (ResponseResult) JSON.parseObject(StringUtil.replaceBlank(result), ResponseResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseResult;
    }

    public <T> TokenResponseResult sendIhyfbToken(String Url, Map map) {

        String requestJson = JSON.toJSONString(map);
        TokenResponseResult responseResult = null;
        try {
            String result = HttpClients.requestPost(Url, requestJson);
            responseResult = (TokenResponseResult) JSON.parseObject(StringUtil.replaceBlank(result), TokenResponseResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseResult;
    }

    public <T> IhyfbResponseResult sendIhyfb(String Url, String body) {


        IhyfbResponseResult responseResult = null;
        try {
            String result = HttpClients.requestPost(Url, body);
            responseResult = (IhyfbResponseResult) JSON.parseObject(StringUtil.replaceBlank(result), IhyfbResponseResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseResult;
    }

    public WlResult sendWl(String Url, String body) {
        WlResult responseResult = null;
        try {
            String result = HttpClients.requestPost(Url, body);
            responseResult = (WlResult) JSON.parseObject(StringUtil.replaceBlank(result), WlResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseResult;
    }

    public ResultJson sendDx(String Url, String body) {
        ResultJson responseResult = null;
        try {
            String result = HttpClients.requestPost(Url, body);
            responseResult = (ResultJson) JSON.parseObject(StringUtil.replaceBlank(result), ResultJson.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseResult;
    }

    public LhResponseResult sendLhMessage(String serviceUrl, ResultJsonData resultJsonData) {
        String requestJson = JSON.toJSONString(resultJsonData);
        LhResponseResult lhResponseResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, requestJson);
            System.out.println(result);
            lhResponseResult = (LhResponseResult) JSON.parseObject(StringUtil.replaceBlank(result), LhResponseResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return lhResponseResult;
    }


    public YfResponseResult sendGdMessage(String url, String body) {
        YfResponseResult gdResponseResult = null;
        try {
            String result = HttpClients.requestPost(url, body);
            gdResponseResult = (YfResponseResult) JSON.parseObject(StringUtil.replaceBlank(result), YfResponseResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return gdResponseResult;
    }

    public HyResultJson sendShhyMessage(String url, String body) {
        HyResultJson gdResponseResult = null;
        try {
            String result = HttpClients.requestPost(url, body);
            gdResponseResult = (HyResultJson) JSON.parseObject(StringUtil.replaceBlank(result), HyResultJson.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return gdResponseResult;
    }

    public WxgdResponseResult sendMessage(String serviceUrl, YjSingle yjSingle, String source, String token) {
        String requestJson = JSON.toJSONString(yjSingle);
//        System.out.println(requestJson);
        WxgdResponseResult sqResponseResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, requestJson, null, source, token);
            System.out.println(result);
            sqResponseResult = (WxgdResponseResult) JSON.parseObject(StringUtil.replaceBlank(result), WxgdResponseResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sqResponseResult;
    }

    public ScsbResultJson sendScsbMessage(String serviceUrl, String json) {
        ScsbResultJson sqResponseResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, json);
            System.out.println(result);
            sqResponseResult = (ScsbResultJson) JSON.parseObject(StringUtil.replaceBlank(result), ScsbResultJson.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sqResponseResult;
    }

    public CompressSlurryResult sendMessage(String serviceUrl, String json) {
        CompressSlurryResult sqResponseResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, json);
            System.out.println(result);
            sqResponseResult = (CompressSlurryResult) JSON.parseObject(StringUtil.replaceBlank(result), CompressSlurryResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sqResponseResult;
    }

    public ZmqbResult sendZmqbMessage(String serviceUrl, String json) {
        ZmqbResult zmqbResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, json);
            System.out.println(result);
            zmqbResult = (ZmqbResult) JSON.parseObject(StringUtil.replaceBlank(result), ZmqbResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zmqbResult;
    }

    public YxtjResultJson sendYxtjMessage(String serviceUrl, String json) {
        YxtjResultJson zmqbResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, json);
            System.out.println(result);
            zmqbResult = (YxtjResultJson) JSON.parseObject(StringUtil.replaceBlank(result), YxtjResultJson.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zmqbResult;
    }
    public YcResult sendYcgsMessage(String serviceUrl, String json) {
        YcResult zmqbResult = null;
        try {
            String result = HttpClients.requestPost(serviceUrl, json);
            System.out.println(result);
            zmqbResult = (YcResult) JSON.parseObject(StringUtil.replaceBlank(result), YcResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zmqbResult;
    }
    /**
     * 中交三航局312国道无锡飞凤路至金城东路段改扩建工程施工项目312XW13标项目经理部
     *
     * @param yjData
     * @param uploadParameter
     * @param uuid
     * @param equNum
     * @return
     */
    public YjSingle getWxgd(YjData yjData, UploadParameter uploadParameter, String uuid, String equNum) {
        YjSingle yjSingle = new YjSingle();
        if (org.springframework.util.StringUtils.isEmpty(uuid)) {
            yjSingle.setUuId(UUID.randomUUID().toString().replace("-", ""));
        } else {
            yjSingle.setUuId(uuid);
        }
        yjSingle.setEquNum(equNum);
        yjSingle.setComponentId(yjSingle.getUuId());
        yjSingle.setEngineeringName(uploadParameter.getGcmc());
        yjSingle.setEngineeringSite(uploadParameter.getSgbw());
        yjSingle.setComponentParts(yjData.getBridge_code());
        yjSingle.setBeamType(uploadParameter.getLblx());
        yjSingle.setConcreteStrength(uploadParameter.getConcretestrength());
        yjSingle.setModulusOfElasticity(uploadParameter.getPumppressure());
        yjSingle.setBridgeName(uploadParameter.getEquipmentname());
        yjSingle.setTrialDate(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        List<WxgdData> wxgdDataList = new ArrayList<>();
        WxgdData wxgdData = new WxgdData();
        wxgdData.setSteelBeamNo(yjData.getDuct_code());
        wxgdData.setSteelStrand(uploadParameter.getKongdaoshu());
        wxgdData.setPulpingOrientation(uploadParameter.getYajiangfangxiang());
        wxgdData.setPulpingOrder(uploadParameter.getYajiangbuzhou());
        wxgdData.setFlowVelocity(uploadParameter.getMsl());
        wxgdData.setFluidity(yjData.getPractical_fluidity());
        wxgdData.setMixProportion(uploadParameter.getPhb());
        wxgdData.setWaterRatio(String.valueOf(yjData.getWater_binder_ratio()));
        wxgdData.setStirringTime(uploadParameter.getStirtime());
        wxgdData.setStartDate(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        wxgdData.setEndDate(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        wxgdData.setPulpingVolume(String.valueOf(yjData.getPractical_mudjack_value()));
        wxgdData.setStandardVolume(uploadParameter.getVolume());
        wxgdData.setPulpingPressureIn(String.valueOf(yjData.getMudjack_pressure()));
        wxgdData.setPulpingPressureOut(String.valueOf(yjData.getSlurry_pressure()));
        wxgdData.setHoldingTime(yjData.getPressurize_time());
        wxgdData.setVolumeCurve("0");
        wxgdData.setPressureinCurve(yjData.getMudjack_curve_graph().replaceAll("-", ","));
        wxgdData.setPressureoutCurve("0");
        wxgdData.setResult("0");
        wxgdData.setUserId(uploadParameter.getBeiyong());
        wxgdData.setOtherInformation("/");
        wxgdData.setParentId(yjSingle.getUuId());
        wxgdData.setUuId(UUID.randomUUID().toString().replace("-", ""));
        wxgdDataList.add(wxgdData);
        yjSingle.setDataList(wxgdDataList);
        return yjSingle;
    }

    /**
     * 上海华岩压浆流量
     *
     * @param yjData
     * @param uploadParameter
     * @param projectId
     * @param sectionCode
     * @param factoryCode
     * @return
     */
    public PostMultiGroutSSProcess getPostMultiGroutSSProcess(YjData yjData, UploadParameter uploadParameter, String projectId, String sectionCode, String factoryCode) {
        PostMultiGroutSSProcess process = new PostMultiGroutSSProcess();
        process.setProjectId(projectId);
        process.setSectionCode(sectionCode);
        process.setFactoryCode(factoryCode);
        process.setBridge(uploadParameter.getPrefabricatelc());
        process.setBeamCode(yjData.getBridge_code());
        process.setKDCode(yjData.getDuct_code());
        List<GroutSSProcessInfo> processInfoList = getProcessList(yjData);
        process.setProcessList(processInfoList);
        return process;
    }

    private List<GroutSSProcessInfo> getProcessList(YjData yjData) {
        List<GroutSSProcessInfo> processInfoList = new ArrayList<>();
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        for (int i = 0; i < mcgList.size(); i++) {
            GroutSSProcessInfo processInfo = new GroutSSProcessInfo();
            processInfo.setDateTime(dateList.get(i));
            if (StringUtils.isNotEmpty(mcgList.get(i))) {
                processInfo.setJJYL(Float.valueOf(mcgList.get(i)));
            } else {
                processInfo.setJJYL(0f);
            }
            processInfo.setCJYL(0f);
            processInfo.setJJL(0f);
            processInfo.setCJL(0f);
            processInfo.setBYSJ(5);
            processInfoList.add(processInfo);
        }
        return processInfoList;
    }

    /**
     * 上海华岩主表
     *
     * @param yjData
     * @param uploadParameter
     * @param projectId
     * @param sectionCode
     * @param factoryCode
     * @return
     */
    public PostGroutData getPostGroutData(YjData yjData, UploadParameter uploadParameter, String projectId, String sectionCode, String factoryCode) {
        PostGroutData postGroutData = new PostGroutData();
        postGroutData.setProjectId(projectId);
        postGroutData.setSectionCode(sectionCode);
        postGroutData.setFactoryCode(factoryCode);
        postGroutData.setBridge(uploadParameter.getPrefabricatelc());
        postGroutData.setBeamCode(yjData.getBridge_code());
        postGroutData.setLTType(uploadParameter.getLblx());
        postGroutData.setProjectPart(uploadParameter.getSgbw());
        postGroutData.setEquipmentMaker("开封齐力");
        postGroutData.setEquipmentType("QLZY-II-300");
        postGroutData.setEquipmentCode(yjData.getDevice_code());
        postGroutData.setZKBYL(Float.parseFloat(uploadParameter.getPumppressure()));
        postGroutData.setTensionTime(uploadParameter.getZlsj());
        postGroutData.setStartTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        postGroutData.setEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        postGroutData.setSGUnit(uploadParameter.getSgdw());
        postGroutData.setJLUnit(uploadParameter.getJldw());
        postGroutData.setSort(3);
        postGroutData.setCount(Integer.getInteger(uploadParameter.getBuzhoucishu()));
        postGroutData.setMode(uploadParameter.getYajiangmoshi());
        postGroutData.setStatus(2);
        postGroutData.setDirection(uploadParameter.getYajiangfangxiang());
        postGroutData.setStep(uploadParameter.getYajiangbuzhou());
        postGroutData.setEnvironmentTemp(String.valueOf(yjData.getEnvironment_temperature()));
        postGroutData.setGroutTemp(String.valueOf(yjData.getSlurry_temperature()));
        postGroutData.setSGWorker("");
        postGroutData.setQAWorker("");
        postGroutData.setJLWorker("");
        postGroutData.setPrincipal("");
        postGroutData.setRecorder("");
        postGroutData.setIsWarning(1);
        postGroutData.setYJLOK(1);
        postGroutData.setSJBOK(1);
        postGroutData.setYJWYOK(1);
        List<HTGS_GroutInfo> groutInfoList = getGroutInfoDataList(yjData, uploadParameter);
        List<HTGS_GroutResult> groutResultList = getGroutResultDataList(yjData, uploadParameter);
        postGroutData.setGroutInfoDataList(groutInfoList);
        postGroutData.setGroutResultDataList(groutResultList);
        return postGroutData;
    }

    private List<HTGS_GroutResult> getGroutResultDataList(YjData yjData, UploadParameter uploadParameter) {
        List<HTGS_GroutResult> groutResultList = new ArrayList<>();
        HTGS_GroutResult groutResult = new HTGS_GroutResult();
        groutResult.setKDCode(yjData.getDuct_code());
        groutResult.setDataID(1);
        groutResult.setStartTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        groutResult.setEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        groutResult.setJJYL(yjData.getMudjack_pressure());
        groutResult.setCJYL(yjData.getSlurry_pressure());
        groutResult.setWYYL(yjData.getStabilize_pressure());
        groutResult.setZYJL(yjData.getPractical_volume());
        groutResult.setBCSJ(Integer.valueOf(yjData.getPressurize_time()));
        groutResult.setSJB(yjData.getWater_binder_ratio());
        groutResult.setLLJL(yjData.getTheory_volume());
        groutResult.setSCJL(yjData.getPractical_volume());
        groutResult.setYJLVol(yjData.getPractical_mudjack_value());
        groutResult.setWaterVol(yjData.getPractical_water_value());
        groutResult.setYJCS(1);
        groutResult.setYJLOK(1);
        groutResult.setSJBOK(1);
        groutResult.setYJWYOK(1);
        groutResult.setIsOK(1);
        groutResult.setMemo("/");
        groutResultList.add(groutResult);
        return groutResultList;
    }

    private List<HTGS_GroutInfo> getGroutInfoDataList(YjData yjData, UploadParameter uploadParameter) {
        List<HTGS_GroutInfo> groutInfoList = new ArrayList<>();
        HTGS_GroutInfo groutInfo = new HTGS_GroutInfo();
        groutInfo.setSNPZ(uploadParameter.getSnmc());
        groutInfo.setSNBH("常规");
        groutInfo.setSNCJ("常规");
        groutInfo.setJBTime(Integer.valueOf(uploadParameter.getStirtime()));
        groutInfo.setSJB(yjData.getWater_binder_ratio());
        groutInfo.setSNYL(yjData.getPractical_mudjack_value());
        groutInfo.setSYL(yjData.getPractical_water_value());
        groutInfo.setWJJName(uploadParameter.getYajiangji());
        groutInfo.setWJJYL(Float.valueOf(uploadParameter.getPhb()));
        groutInfo.setSNJQD_Design(0f);
        groutInfo.setSNJQD_Actual(0f);
        groutInfo.setSNJCD_Design(0f);
        groutInfo.setSNJCD_Actual(0f);
        groutInfo.setSNJLDD_Design(Float.valueOf(uploadParameter.getMsl()));
        groutInfo.setSNJLDD_Actual(Float.valueOf(yjData.getPractical_fluidity()));
        groutInfo.setZDQSL_Design(0f);
        groutInfo.setZDQSL_Actual(0f);
        groutInfo.setSNBH_3H_Design(0f);
        groutInfo.setSNBH_3H_Actual(0f);
        groutInfo.setSNBH_24H_Design(0f);
        groutInfo.setSNBH_24H_Actual(Float.valueOf(uploadParameter.getHolelength()));
        groutInfoList.add(groutInfo);
        return groutInfoList;
    }

    /**
     * 204国道主表
     *
     * @param yjData
     * @param uploadParameter
     * @param uuid
     * @param sbbh
     * @return
     */
    public YfYjInfo getGdYjInfo(YjData yjData, UploadParameter uploadParameter, String uuid, String syjid, String sbbh) {
        YfYjInfo gdYjInfo = new YfYjInfo();
        if ("".equals(syjid)) {
            gdYjInfo.setSyjid(UUID.randomUUID().toString().replace("-", ""));
        } else {
            gdYjInfo.setSyjid(syjid);
        }
        gdYjInfo.setSgdw(uploadParameter.getSgdw());
        gdYjInfo.setJldw(uploadParameter.getJldw());
        gdYjInfo.setHtbh(uploadParameter.getHtbh());
        gdYjInfo.setGcmc(uploadParameter.getGcmc());
        gdYjInfo.setYjsj(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        gdYjInfo.setZhbw(uploadParameter.getZhbw());
        gdYjInfo.setSgbw(uploadParameter.getSgbw());
        gdYjInfo.setGjjg(uploadParameter.getGjjg());
        gdYjInfo.setGjbh(yjData.getBridge_code());
        gdYjInfo.setQw(String.valueOf(yjData.getEnvironment_temperature()));
        gdYjInfo.setCjsjl(uploadParameter.getCjsjl());
        gdYjInfo.setCpzjl(uploadParameter.getCpzjl());
        gdYjInfo.setSw(uploadParameter.getSw());
        gdYjInfo.setShuijiaobi(String.valueOf(yjData.getWater_binder_ratio()));
        gdYjInfo.setSnyl(uploadParameter.getSnyl());
        gdYjInfo.setYjwd(String.valueOf(yjData.getSlurry_temperature()));
        gdYjInfo.setMsl(uploadParameter.getMsl());
        gdYjInfo.setBeiyong(uploadParameter.getBeiyong());
        gdYjInfo.setYjsbbh(sbbh);
        gdYjInfo.setLblx(uploadParameter.getLblx());
        gdYjInfo.setLianghao(yjData.getBridge_code());
        gdYjInfo.setZlsj(uploadParameter.getZlsj());
        gdYjInfo.setYajiangji(uploadParameter.getYajiangji());
        gdYjInfo.setSnmc(uploadParameter.getSnmc());
        gdYjInfo.setKongdaoshu(uploadParameter.getKongdaoshu());
        gdYjInfo.setYajiangfang(uploadParameter.getYajiangfangxiang());
        gdYjInfo.setYajiangbuzh(uploadParameter.getYajiangbuzhou());
        gdYjInfo.setYajiangguoc(uploadParameter.getYajiangguocheng());
        gdYjInfo.setChushisudu(yjData.getPractical_fluidity());
        gdYjInfo.setLiudongdu(yjData.getPractical_fluidity());
        gdYjInfo.setMemo(uploadParameter.getMemo());
        gdYjInfo.setStatus(uploadParameter.getStatus());
        gdYjInfo.setGuid(UUID.randomUUID().toString().replace("-", ""));
        gdYjInfo.setUuid(uuid);
        gdYjInfo.setIssend("完成");
        List<YfYjData> gdYjData = getYfYjData(yjData, uploadParameter, gdYjInfo.getSyjid());
        gdYjInfo.setYajiangs(gdYjData);
        return gdYjInfo;
    }

    /**
     * 国道204从表
     *
     * @param yjData
     * @param uploadParameter
     * @param syjid
     * @return
     */
    private List<YfYjData> getYfYjData(YjData yjData, UploadParameter uploadParameter, String syjid) {
        List<YfYjData> gdYjDataList = new ArrayList<>();
        YfYjData gdYjData = new YfYjData();
        String uuid = UUID.randomUUID().toString().replace("-", "");
        gdYjData.setFguid(uuid);
        gdYjData.setSyjid(syjid);
        gdYjData.setYajiangsj(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        gdYjData.setStatus("1");
        gdYjData.setKongdao(yjData.getDuct_code());
        gdYjData.setYajiangmosh(uploadParameter.getYajiangmoshi());
        gdYjData.setPeihebi(uploadParameter.getPhb());
        gdYjData.setShuijiaobi(String.valueOf(yjData.getWater_binder_ratio()));
        gdYjData.setJiaobansj("300");
        gdYjData.setStarttime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        gdYjData.setEndtime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        gdYjData.setJinjiangyal(String.valueOf(yjData.getMudjack_pressure()));
        gdYjData.setFanjiangyal(String.valueOf(yjData.getSlurry_pressure()));
        gdYjData.setChixushijia("300");
        gdYjData.setJinjiangshu(uploadParameter.getJinjiangshuliang());
        gdYjData.setFanjianglia(uploadParameter.getFanjiangliang());
        gdYjData.setZkyl("1");
        gdYjData.setTongguo("通过");
        gdYjData.setYjcs("1");
        gdYjData.setHege("1");
        gdYjData.setMjqk("正常");
        gdYjData.setHoleid(uuid);
        gdYjDataList.add(gdYjData);
        return gdYjDataList;
    }

    public List<YfYjRealData> getYfYjRealData(YjData yjData, String holeid, String shebeibianh) {
        List<YfYjRealData> gdYjRealDataList = new ArrayList<>();
        Map<String, List> graphData = yjDataService.getGraphData2(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        for (int i = 0; i < mcgList.size(); i++) {
            YfYjRealData gdYjRealData = new YfYjRealData();
            gdYjRealData.setSid(UUID.randomUUID().toString().replace("-", ""));
            gdYjRealData.setHoleid(holeid);
            gdYjRealData.setShebeibianh(shebeibianh);
            gdYjRealData.setJlsj(yjData.getMudjack_date() + " " + dateList.get(i));
            gdYjRealData.setCysj("5");
            gdYjRealData.setZt("正常");
            gdYjRealData.setJjyl(mcgList.get(i));
            gdYjRealData.setFjyl("0");
            gdYjRealData.setJjl("0");
            gdYjRealData.setFjl("0");
            gdYjRealDataList.add(gdYjRealData);
        }
        return gdYjRealDataList;
    }

    /**
     * 福州至长乐二标压浆主表
     *
     * @param yjData
     * @param uploadParameter
     * @param projectId
     * @return
     */
    public GroutingSteel getGroutingSteel(YjData yjData, UploadParameter uploadParameter, String projectId) {
        GroutingSteel groutingSteel = new GroutingSteel();
        groutingSteel.setProjectId(projectId);
        groutingSteel.setBeamCode(yjData.getBridge_code());
        groutingSteel.setDeviceCode("2022062001");
        groutingSteel.setSteelCode(yjData.getDuct_code());
        groutingSteel.setBeamFieldName("帝祥预制场");
        groutingSteel.setBridgeName("帝祥区间");
        groutingSteel.setSizingAgentModel(uploadParameter.getYajiangji());
        groutingSteel.setGroutingAgentName(uploadParameter.getYajiangji());
        groutingSteel.setProPlace(uploadParameter.getSgbw());
        groutingSteel.setPulpingCondition(uploadParameter.getYajiangbuzhou());
        groutingSteel.setGroAspect(uploadParameter.getYajiangfangxiang());
        groutingSteel.setStirTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        groutingSteel.setSlurryTemperature(26.0);
        groutingSteel.setMixtureProportion(Double.valueOf(uploadParameter.getPhb()));
        groutingSteel.setFluidity(Double.valueOf(yjData.getPractical_fluidity()));
        groutingSteel.setConOperator("刘海强");
        groutingSteel.setSupervisors("林志平");
        groutingSteel.setQuaInspector("藏小西");
        groutingSteel.setTechnicalDirector("李龙龙");
        groutingSteel.setGroutingDate(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        groutingSteel.setCastingDate(TimeHelper.getJzrq(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss", -7));
        return groutingSteel;
    }

    public List<GroutingInfo> getGroutingInfo(YjData yjData, String projectId, String steelId) {
        List<GroutingInfo> groutingInfoList = new ArrayList<>();
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        for (int i = 0; i < mcgList.size(); i++) {
            GroutingInfo groutingInfo = new GroutingInfo();
            groutingInfo.setProjectId(projectId);
            groutingInfo.setSteelGroId(steelId);
            groutingInfo.setSteelCode(yjData.getDuct_code());
            groutingInfo.setGroutingDate(yjData.getMudjack_date() + " " + dateList.get(i));
            groutingInfo.setSSLL(0f);
            groutingInfo.setCJYL(0f);
            groutingInfo.setYJYL(Float.valueOf(mcgList.get(i)));
            groutingInfoList.add(groutingInfo);
        }
        return groutingInfoList;
    }

    public GroutingResult getGroutingResult(YjData yjData, String projectId, String steelId) {
        List<YjData> yjDataList = yjDataService.findYjdataByDeviceCodAndBridgeCode(yjData.getDevice_code(), yjData.getBridge_code());
        int index = 1;
        for (int i = 0; i < yjDataList.size(); i++) {
            YjData yjData1 = yjDataList.get(i);
            if (yjData.getDevice_code().equals(yjData1.getDevice_code()) && yjData.getBridge_code().equals(yjData1.getBridge_code()) && yjData.getDuct_code().equals(yjData1.getDuct_code())) {
                index = i + 1;
            }
        }
        GroutingResult groutingResult = new GroutingResult();
        groutingResult.setProjectId(projectId);
        groutingResult.setSteelGroId(steelId);
        groutingResult.setNIndex(index);
        groutingResult.setSteelCode(yjData.getDuct_code());
        groutingResult.setGrouBeginTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        groutingResult.setGrouEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        groutingResult.setSlurryPressure(yjData.getSlurry_pressure());
        groutingResult.setFeedPressure(yjData.getMudjack_pressure());
        groutingResult.setPressureTime(Integer.valueOf(yjData.getPressurize_time()));
        groutingResult.setWaterBinderRatio(yjData.getWater_binder_ratio());
        groutingResult.setFeedVolume(yjData.getPractical_volume());
        groutingResult.setRemark("");
        return groutingResult;
    }


    /**
     * 黎霍高速高速
     *
     * @param yjDataList
     * @param yjEquipmentId
     * @return
     */

    public List<YJBeamData> getLhYjData(List<YjData> yjDataList, String yjEquipmentId) {
        List<YJBeamData> yjBeamDataList = new ArrayList<>();
        YJBeamData yjBeamData = new YJBeamData();
//        if (org.apache.commons.lang3.StringUtils.isEmpty(uuid)){
        yjBeamData.setId(UUID.randomUUID().toString().replace("-", ""));
  /*      }else {
            yjBeamData.setId(uuid);
        }*/
        yjBeamData.setCreatedTime(TimeHelper.getCurrentTime());
        yjBeamData.setBeamManafacturerName("1#梁场");
        yjBeamData.setName(yjDataList.get(0).getBridge_code());
        yjBeamData.setFinalDate(TimeHelper.getJzrq(yjDataList.get(0).getMudjack_date() + " 08:20:00", "yyyy-MM-dd HH:mm:ss", -1));
        yjBeamData.setDuctType("波纹管");
        yjBeamData.setProjectName("黎霍高速");
        yjBeamData.setCode(yjDataList.get(0).getBridge_code());
        yjBeamData.setMudjackDate(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time());
        yjBeamData.setSpan("30");
        yjBeamData.setBriquetteDismantleIntensity("8.9");
        yjBeamData.setBriquettePressureIntensity("50");
        yjBeamData.setEnvironmentTemperature("25");
        yjBeamData.setShape("T梁");
        yjBeamData.setVacuumManometerDate("2022-03-10 08:00:00");
        yjBeamData.setGravitySensorDate("2022-03-11 08:00:00");
        yjBeamData.setPressureGageDate("2022-03-12 08:00:00");
        yjBeamData.setCementManufacturer("常规");
        yjBeamData.setCementSpecification("JL-YJL压浆料");
        yjBeamData.setCementBatch("20220040001");
        yjBeamData.setCableGroutingAgentsManufacturer("河北久联");
        yjBeamData.setCableGroutingAgentsSpecification("JL-YJL压浆料");
        yjBeamData.setCableFroutingAgentsBatch("20220040001");
        yjBeamData.setSelfInspectionOpinion("/");
        yjBeamData.setEmergency("/");
        yjBeamData.setQuestionResults("/");
        yjBeamData.setSupervisorOpinion("/");
        yjBeamData.setOperatingPersonnel("/");
        yjBeamData.setTechnicist("/");
        yjBeamData.setCastingTime(TimeHelper.getJzrq(yjDataList.get(0).getMudjack_date() + " 08:30:00", "yyyy-MM-dd HH:mm:ss", -8));
        List<YJBeamDetail> YJBeamDetailList = getYJBeamDetailList(yjDataList, yjBeamData, yjEquipmentId);
        List<YJBeamCurveGraph> yjBeamCurveGraphList = getYJBeamCurveGraph(YJBeamDetailList);

        yjBeamData.setYjBeamDetail(YJBeamDetailList);
        yjBeamData.setYjBeamCurveGraph(yjBeamCurveGraphList);
        yjBeamDataList.add(yjBeamData);
        return yjBeamDataList;

    }

    private List<YJBeamDetail> getYJBeamDetailList(List<YjData> yjDataList, YJBeamData yjBeamData, String yjEquipmentId) {
        List<YJBeamDetail> yjBeamDetailList = new ArrayList<>();
        int i = 1;
        for (YjData yjData : yjDataList) {
            YJBeamDetail yjBeamDetail = new YJBeamDetail();
            yjBeamDetail.setId(UUID.randomUUID().toString().replace("-", ""));
            yjBeamDetail.setCreatedTime(TimeHelper.getCurrentTime());
            yjBeamDetail.setSlurryingNo(Integer.toString(i));
            yjBeamDetail.setSlurryTemperature(Float.toString(yjData.getSlurry_temperature()));
            yjBeamDetail.setTheoryRateOfCharge("50:6.82:0");
            yjBeamDetail.setInitialFluidity(yjData.getPractical_fluidity());
            yjBeamDetail.setMudjackSequence(i);
            yjBeamDetail.setDuctCode(yjData.getDuct_code());
            yjBeamDetail.setDuctDiameter("75");
            yjBeamDetail.setVacuoPressure("0");
            yjBeamDetail.setBeginTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            yjBeamDetail.setEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
            yjBeamDetail.setMudjackTime(Long.toString(TimeHelper.getTime(yjData.getMudjack_date() + " " + yjData.getBegin_time(), yjData.getMudjack_date() + " " + yjData.getEnd_time())));
            yjBeamDetail.setMudjackPressure(Float.toString(yjData.getMudjack_pressure()));
            yjBeamDetail.setSlurryPressure(Float.toString(yjData.getSlurry_pressure()));
            yjBeamDetail.setPressurizeTime("180");
            yjBeamDetail.setWaterBinderRatio(Float.toString(yjData.getWater_binder_ratio()));
            yjBeamDetail.setTheoryMudjackValue(Float.toString(yjData.getTheory_volume()));
            yjBeamDetail.setPracticalMudjackValue(Float.toString(yjData.getPractical_volume()));
            DecimalFormat format = new DecimalFormat(".00");
            String format1 = format.format(yjData.getTheory_volume() - yjData.getPractical_volume());
            yjBeamDetail.setMudjackValueError(format1);
            yjBeamDetail.setRemark("/");
            yjBeamDetail.setMudjackBeamId(yjBeamData.getId());
            yjBeamDetail.setMudjackPattern("大循环");
            yjBeamDetail.setFacilityId(yjEquipmentId);
            yjBeamDetailList.add(yjBeamDetail);
            i++;
        }
        return yjBeamDetailList;
    }

    private List<YJBeamCurveGraph> getYJBeamCurveGraph(List<YJBeamDetail> YJBeamDetailList) {
        List<YJBeamCurveGraph> yjBeamCurveGraphList = new ArrayList<>();
        for (YJBeamDetail yjBeamDetail : YJBeamDetailList) {
            YJBeamCurveGraph yjBeamCurveGraph = new YJBeamCurveGraph();
            yjBeamCurveGraph.setId(UUID.randomUUID().toString().replace("-", ""));
            yjBeamCurveGraph.setCreatedTime(TimeHelper.getCurrentTime());
            yjBeamCurveGraph.setMudjackOperationId(yjBeamDetail.getId());
            List<MudjackCurve> mudjackCurveList = new ArrayList<>();
            MudjackCurve mudjackCurve = new MudjackCurve();
            mudjackCurve.setT("00:00:00");
            mudjackCurve.setP1(0.0);
            mudjackCurve.setP2(0.0);
            mudjackCurve.setV1(0.0);
            mudjackCurve.setV2(0.0);
            mudjackCurveList.add(mudjackCurve);
            yjBeamCurveGraph.setMudjackCurve(mudjackCurveList);
            yjBeamCurveGraphList.add(yjBeamCurveGraph);
        }
        return yjBeamCurveGraphList;
    }

    /**
     * 德余八标压浆一号机
     *
     * @param yjDataList
     * @param uploadParameter
     * @param sbbh
     * @return
     */
    public DyYjData getDyYjData(List<YjData> yjDataList, UploadParameter uploadParameter, String sbbh) {
        DyYjData dyYjData = new DyYjData();
        List<YjInfo> yjInfoList = new ArrayList<>();
        List<YjRealData> yjRealDataList = new ArrayList<>();
        YjInfo yjInfo = new YjInfo();
        yjInfo.setBeamno(yjDataList.get(0).getBridge_code());
        yjInfo.setXmName("");
        yjInfo.setBdName("");
        yjInfo.setLcName("");
        yjInfo.setGdName(uploadParameter.getGcmc());
        yjInfo.setSbbh(sbbh);
        yjInfo.setGcbw(uploadParameter.getSgbw());
        yjInfo.setLblx(uploadParameter.getLblx());
        yjInfo.setLbcd(0f);
        yjInfo.setLbks(0);
        yjInfo.setJzrq("");
        yjInfo.setYjrq(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time());
        yjInfo.setZlsj(uploadParameter.getZlsj());
        yjInfo.setKssj(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time());
        yjInfo.setJssj(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getEnd_time());
        yjInfo.setYjsx(1);
        yjInfo.setYjcs(Integer.parseInt(uploadParameter.getBuzhoucishu()));
        yjInfo.setYjms(uploadParameter.getYajiangmoshi());
        yjInfo.setZt(2);
        yjInfo.setSnmc("");
        yjInfo.setYjjmc("");
        yjInfo.setYjfx(uploadParameter.getYajiangfangxiang());
        yjInfo.setYjbz(uploadParameter.getYajiangbuzhou());
        yjInfo.setJbsj(0f);
        yjInfo.setCsldd(0f);
        yjInfo.setZkbyl(Float.valueOf(uploadParameter.getPumppressure()));
        yjInfo.setJywd(18f);
        yjInfo.setHjwd(yjDataList.get(0).getEnvironment_temperature());
        yjInfo.setPhb("");
        yjInfo.setSgdwName(uploadParameter.getSgdw());
        yjInfo.setJldwName(uploadParameter.getJldw());
        yjInfo.setJcdwName("");
        yjInfo.setSgy("测试1");
        yjInfo.setJlry("测试2");
        yjInfo.setZljcy("测试3");
        yjInfo.setJcry("测试4");
        yjInfo.setJilry("测试5");
        yjInfo.setKzqk(1);
        yjInfo.setYjlsfzc(1);
        yjInfo.setSjbsfzc(1);
        yjInfo.setYjwysfzc(1);
        yjInfo.setSccj("");
        yjInfo.setClgghxh("");
        yjInfo.setJyphb("");
        yjInfo.setJyxnzbfhx("");
        yjInfo.setSjzq("");
        yjInfo.setZjgy("");
        List<BeamInfoData> beamInfoDataList = new ArrayList<>();
        BeamInfoData beamInfoData = new BeamInfoData();
        beamInfoData.setSNPZ("常规水泥");
        beamInfoData.setSNBH("常规");
        beamInfoData.setSNCJ("常规");
        beamInfoData.setJBTime(60);
        beamInfoData.setSJB(0.27f);
        beamInfoData.setWJJName("常规外加剂");
        beamInfoData.setWJJYL(0f);
        beamInfoData.setSNJQD_Design(50f);
        beamInfoData.setSNJQD_Actual(50f);
        beamInfoData.setSNJCD_Design(50f);
        beamInfoData.setSNJCD_Actual(50f);
        beamInfoData.setSNJLDD_Design(50f);
        beamInfoData.setSNJLDD_Actual(50f);
        beamInfoData.setZDQSL_Design(0f);
        beamInfoData.setZDQSL_Actual(0f);
        beamInfoData.setSNBH_3H_Design(0f);
        beamInfoData.setSNBH_3H_Actual(0f);
        beamInfoData.setSNBH_24H_Design(0f);
        beamInfoData.setSNBH_24H_Actual(0f);
        beamInfoDataList.add(beamInfoData);
        yjInfo.setBeamInfoData(beamInfoDataList);
        List<BeamGroutRes> beamGroutResList = new ArrayList<>();
        int i = 1;
        for (YjData yjData : yjDataList) {
            BeamGroutRes beamGroutRes = new BeamGroutRes();
            beamGroutRes.setSxdh(i);
            beamGroutRes.setGsbh(yjData.getDuct_code());
            beamGroutRes.setKssj(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            beamGroutRes.setJssj(yjData.getMudjack_date() + " " + yjData.getEnd_time());
            beamGroutRes.setJjyl(yjData.getMudjack_pressure());
            beamGroutRes.setFjyl(yjData.getSlurry_pressure());
            beamGroutRes.setCysj(Float.valueOf(yjData.getPressurize_time()));
            beamGroutRes.setZyjl(Float.valueOf(yjData.getPractical_mudjack_value()));
            beamGroutRes.setSjb(Float.valueOf(yjData.getWater_binder_ratio()));
            beamGroutRes.setBz("");
            beamGroutRes.setZdyl("");
            beamGroutRes.setWyyl(Float.toString(yjData.getStabilize_pressure()));
            beamGroutRes.setWysj(yjData.getPressurize_time());
            beamGroutRes.setLljl(Float.valueOf(yjData.getTheory_volume()));
            beamGroutRes.setSczyjjl(Float.valueOf(yjData.getPractical_volume()));
            beamGroutRes.setYjltj(Float.valueOf(yjData.getPractical_mudjack_value()));
            beamGroutRes.setStj(Float.valueOf(yjData.getPractical_water_value()));
            beamGroutRes.setYjcs(1);
            beamGroutRes.setYjlsfzc(1);
            beamGroutRes.setSjbsfzc(1);
            beamGroutRes.setYjwysfzc(1);
            beamGroutRes.setSfzc(1);
            beamGroutRes.setZkd("");
            beamGroutRes.setMjqk("");
            i++;
            beamGroutResList.add(beamGroutRes);

        }
        yjInfo.setBeamGroutRes(beamGroutResList);
        yjInfoList.add(yjInfo);
        yjRealDataList = getYjRealDataList(yjDataList, sbbh);
        dyYjData.setTableData(yjInfoList);
        dyYjData.setTableData1(yjRealDataList);
        return dyYjData;
    }

    private List<YjRealData> getYjRealDataList(List<YjData> yjDataList, String sbbh) {
        List<YjRealData> yjRealDataList = new ArrayList<>();
        for (YjData yjData : yjDataList) {
            YjRealData yjRealData = new YjRealData();
            yjRealData.setBeamno(yjData.getBridge_code());
            yjRealData.setSbbh(sbbh);
            yjRealData.setZlrq(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            yjRealData.setGsbm(yjData.getDuct_code());
            yjRealData.setZlcs(1);
            List<Lbzl> lbzlList = getLbzlList(yjData);
            yjRealData.setLbzlList(lbzlList);
            yjRealDataList.add(yjRealData);
        }
        return yjRealDataList;
    }

    private List<Lbzl> getLbzlList(YjData yjData) {
        List<Lbzl> lbzlList = new ArrayList<>();
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        for (int i = 0; i < mcgList.size(); i++) {
            Lbzl lbzl = new Lbzl();
            lbzl.setBysj(5);
            lbzl.setSj(dateList.get(i));
            lbzl.setJjyl(Float.valueOf(mcgList.get(i)));
            lbzl.setFjyl(0f);
            lbzl.setJjzl(0f);
            lbzl.setCjzl(0f);
            lbzl.setSjb(0.27f);
            lbzlList.add(lbzl);
        }

        return lbzlList;
    }


    /**
     * 温岭压浆主表
     *
     * @param yjData
     * @param uploadParameter
     * @return
     */
    public WlYjData getWlYjData(YjData yjData, UploadParameter uploadParameter, String vendorno, String deviceno) {
        WlYjData wlYjData = new WlYjData();
        wlYjData.setId(UUID.randomUUID().toString().replace("-", ""));
        wlYjData.setTaskNo("");
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List list = graphData.get("dateList");
        List mcgList = graphData.get("mcgList");
        System.out.println(list.toString());
        wlYjData.setPlatformdeviceid("");
        wlYjData.setVendorno(vendorno);
        wlYjData.setDeviceno(deviceno);
        wlYjData.setComponentid("");
        wlYjData.setComponentparts(yjData.getBridge_code());
        wlYjData.setEngineeringname(uploadParameter.getGcmc());
        wlYjData.setEngineeringsite(uploadParameter.getSgbw());
        wlYjData.setBeamtype(uploadParameter.getLblx());
        wlYjData.setConcretestrength(uploadParameter.getConcretestrength());
        wlYjData.setModulusofelasticity(0);
        wlYjData.setSteelbeamno(yjData.getDuct_code());
        wlYjData.setSteelstrand("");
        wlYjData.setPulpingorientation(uploadParameter.getYajiangfangxiang());
        wlYjData.setPulpingorder(uploadParameter.getYajiangbuzhou());
        wlYjData.setFlowvelocity(yjData.getPractical_fluidity());
        wlYjData.setFluidity(yjData.getPractical_fluidity());
        wlYjData.setMixproportion(uploadParameter.getPhb());
        wlYjData.setWaterratio(Float.toString(yjData.getWater_binder_ratio()));
        wlYjData.setStirringtime(uploadParameter.getStirtime());
        wlYjData.setStartdate(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        wlYjData.setEnddate(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        wlYjData.setVacuumdegree("");
        wlYjData.setCycletime("");
        wlYjData.setStabilizingpressure(Float.toString(yjData.getStabilize_pressure()));
        wlYjData.setPulpingvolume(Float.toString(yjData.getPractical_volume()));
        wlYjData.setStandardvolume(Float.toString(yjData.getTheory_volume()));
        wlYjData.setMeasuretype("1");
        wlYjData.setPulpingpressurein(Float.toString(yjData.getMudjack_pressure()));
        wlYjData.setPulpingpressureout(Float.toString(yjData.getStabilize_pressure()));
        wlYjData.setHoldingtime(yjData.getPressurize_time());
        wlYjData.setVolumecurve("");
        String strip = StringUtils.strip(mcgList.toString(), "[]");
        String msg = strip.replaceAll("(\\\r\\\n|\\\r|\\\n|\\\n\\\r)", "");
        wlYjData.setPressureincurve(msg);
        wlYjData.setPressureoutcurve("");
        wlYjData.setTimecurve(StringUtils.strip(list.toString(), "[]"));
        wlYjData.setResult("0");
        wlYjData.setUserid(uploadParameter.getMemo());
        wlYjData.setOtherinformation("/");
        wlYjData.setBirthtime(TimeHelper.parseDate1(new Date()));
        wlYjData.setHoletype("0");
        wlYjData.setGoutingmode("0");
        return wlYjData;
    }


    /**
     * 杭绍甬压浆主表
     *
     * @param yjData
     * @param uploadParameter
     * @return
     */
    public List<Yjsy_M> getYjsy_M(YjData yjData, UploadParameter uploadParameter) {
        Yjsy_M yjsy_m = new Yjsy_M();
        List<Yjsy_M> yjsyMList = new ArrayList<>();

        String uuid = UUID.randomUUID().toString().replace("-", "");
        yjsy_m.setSyjid(uuid);
        yjsy_m.setShebeibianhao("yjnh05_01_01");
        yjsy_m.setSgdw(uploadParameter.getSgdw());
        yjsy_m.setJldw(uploadParameter.getJldw());
        yjsy_m.setHtbh(uploadParameter.getHtbh());
        yjsy_m.setGcmc(uploadParameter.getGcmc());
        yjsy_m.setYjsj(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        yjsy_m.setZhbw(uploadParameter.getZhbw());
        yjsy_m.setSgbw(uploadParameter.getSgbw());
        yjsy_m.setGjjg(uploadParameter.getGjjg());
        yjsy_m.setGjbh(yjData.getBridge_code());
        yjsy_m.setQw(String.valueOf(yjData.getEnvironment_temperature()));
        yjsy_m.setCjsjl(uploadParameter.getCjsjl());
        yjsy_m.setCpzjl(uploadParameter.getCpzjl());
        yjsy_m.setSw(uploadParameter.getSw());
        yjsy_m.setShuijiaobi(String.valueOf(yjData.getWater_binder_ratio()));
        yjsy_m.setSnyl(uploadParameter.getSnyl());
        yjsy_m.setYjwd(String.valueOf(yjData.getSlurry_temperature()));
        yjsy_m.setMsl(uploadParameter.getMsl());
        yjsy_m.setBeiyong(uploadParameter.getBeiyong());
        yjsy_m.setYjsbbh(yjData.getDevice_code());
        yjsy_m.setLblx(uploadParameter.getLblx());
        yjsy_m.setLianghao(yjData.getBridge_code());
        yjsy_m.setZlsj(uploadParameter.getZlsj());
        yjsy_m.setYajiangji(uploadParameter.getYajiangji());
        yjsy_m.setSnmc(uploadParameter.getSnmc());
        yjsy_m.setKongdaoshu(uploadParameter.getKongdaoshu());
        yjsy_m.setYajiangfangxiang(uploadParameter.getYajiangfangxiang());
        yjsy_m.setYajiangbuzhou(uploadParameter.getYajiangbuzhou());
        yjsy_m.setYajiangguocheng(uploadParameter.getYajiangguocheng());
        yjsy_m.setChushisudu(yjData.getPractical_fluidity());
        yjsy_m.setLiudongdu(yjData.getPractical_fluidity());
        yjsy_m.setMemo(uploadParameter.getMemo());
        yjsy_m.setStatus(uploadParameter.getStatus());
        yjsyMList.add(yjsy_m);
        return yjsyMList;
    }

    /**
     * 杭绍甬压浆详情表
     *
     * @param yjData
     * @param uploadParameter
     * @param id
     * @return
     */
    public List<Yjsy_S> getYjsy_s(YjData yjData, UploadParameter uploadParameter, String id) {
        List<Yjsy_S> yjsy_sList = new ArrayList<>();
        Yjsy_S yjsy_s = new Yjsy_S();
        String uuid = UUID.randomUUID().toString().replace("-", "");
        yjsy_s.setF_guid(uuid);
        yjsy_s.setSyjid(id);
        yjsy_s.setYajiangsj(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        yjsy_s.setKongdao(yjData.getDuct_code());
        yjsy_s.setYajiangmoshi(uploadParameter.getYajiangmoshi());
        yjsy_s.setPeihebi(uploadParameter.getPhb());
        yjsy_s.setShuijiaobi(String.valueOf(yjData.getWater_binder_ratio()));
        yjsy_s.setJiaobansj("300");
        yjsy_s.setStarttime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        yjsy_s.setEndtime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        yjsy_s.setJinjiangyali(String.valueOf(yjData.getMudjack_pressure()));
        yjsy_s.setFanjiangyali(String.valueOf(yjData.getSlurry_pressure()));
        yjsy_s.setChixushijian("300");
        yjsy_s.setJinjiangshuliang(uploadParameter.getJinjiangshuliang());
        yjsy_s.setFanjiangliang(uploadParameter.getFanjiangliang());
        yjsy_s.setZkyl("1");
        yjsy_s.setTongguo("");
        yjsy_s.setYjcs("1");
        yjsy_s.setHege("1");
        yjsy_s.setHoleid(uuid);
        yjsy_s.setStatus("1");
        yjsy_sList.add(yjsy_s);
        return yjsy_sList;
    }

    /**
     * 杭绍甬压浆实时表
     *
     * @param yjData
     * @param uploadParameter
     * @param id
     * @return
     */
    public List<Yjsy_S_S> getYjsy_S_S(YjData yjData, UploadParameter uploadParameter, String id) {
        List<Yjsy_S_S> yjsy_s_sList = new ArrayList<>();
        //进浆压力曲线点
        String mudjack_curve_graph = yjData.getMudjack_curve_graph();
        String[] split = mudjack_curve_graph.split("-");
        String begin_time = yjData.getBegin_time();
        for (String s : split) {
            Yjsy_S_S yjsy_s_s = new Yjsy_S_S();
            yjsy_s_s.setSid(UUID.randomUUID().toString().replace("-", ""));
            yjsy_s_s.setShebeibianhao(uploadParameter.getShebeibianhao());
            yjsy_s_s.setHoleid(id);
            yjsy_s_s.setJlsj(yjData.getMudjack_date() + " " + begin_time);
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
            Date parse = null;
            try {
                parse = sdf.parse(begin_time);
                Date date = new Date(parse.getTime() + 5 * 1000);
                String format = sdf.format(date);
                begin_time = format;
            } catch (ParseException e) {
                e.printStackTrace();
            }
            yjsy_s_s.setCysj("5");
            yjsy_s_s.setZt("正常");
            yjsy_s_s.setJjyl(s);
            yjsy_s_s.setFjyl("0");
            yjsy_s_s.setJjl("0");
            yjsy_s_s.setFjl("0");
            yjsy_s_sList.add(yjsy_s_s);
        }
        return yjsy_s_sList;
    }

    /**
     * 获取灵华一分部压浆主表
     *
     * @param token
     * @param yjData
     * @param uploadParameter
     * @return
     */
    public LHmudjack getLHmudjack(String token, YjData yjData, UploadParameter uploadParameter) {
        LHmudjack mudjack = new LHmudjack();
        mudjack.setToken(token);
        mudjack.setMd_uuid(UUID.randomUUID().toString());
        mudjack.setPrefabricatelc(uploadParameter.getPrefabricatelc());
        mudjack.setStationed(uploadParameter.getStationed());
        mudjack.setContractnum(uploadParameter.getHtbh());
        mudjack.setEquipmentnum(yjData.getDevice_code());
        mudjack.setEquipmentname(uploadParameter.getEquipmentname());
        mudjack.setSupervisionunit(uploadParameter.getJldw());
        mudjack.setContracted("12");
        mudjack.setProjectname(uploadParameter.getGcmc());
        mudjack.setConcretename(uploadParameter.getSnmc());
        mudjack.setMudjackname(uploadParameter.getYajiangji());
        mudjack.setBeamtype(uploadParameter.getLblx());
        mudjack.setHolecount(uploadParameter.getKongdaoshu());
        mudjack.setMudjackdirect(uploadParameter.getYajiangfangxiang());
        mudjack.setStepnum(uploadParameter.getBuzhoucishu());
        mudjack.setStepparam(uploadParameter.getYajiangbuzhou());
        mudjack.setInitialflowspeed(yjData.getPractical_fluidity());
        mudjack.setMobility(yjData.getPractical_fluidity());
        mudjack.setDutyperson(uploadParameter.getMemo());
        mudjack.setPilenum(uploadParameter.getZhbw());
        mudjack.setBeamnum(yjData.getBridge_code());
        mudjack.setHolenum(yjData.getDuct_code());
        mudjack.setMudjackmode(uploadParameter.getYajiangmoshi());
        mudjack.setStretchdate(uploadParameter.getZlsj());
        mudjack.setStrandedwireecount("0");
        mudjack.setHoleinternal(uploadParameter.getHoleinternal());
        mudjack.setHolelength(uploadParameter.getHolelength());
        mudjack.setVolume(uploadParameter.getVolume());
        mudjack.setVolumeL(uploadParameter.getVolumeL());
        mudjack.setMudjackdate(yjData.getMudjack_date() + " 00:00:00");
        mudjack.setGroutingagent(uploadParameter.getPhb());
        mudjack.setWcratio(Float.toString(yjData.getWater_binder_ratio()));
        mudjack.setStirtime(uploadParameter.getStirtime());
        mudjack.setTobj(Float.toString(yjData.getEnvironment_temperature()));
        mudjack.setTamb(Float.toString(yjData.getSlurry_temperature()));
        mudjack.setStarttime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
        mudjack.setEndtime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
        mudjack.setEnterpressure(Float.toString(yjData.getMudjack_pressure()));
        mudjack.setOutpressure(Float.toString(yjData.getStabilize_pressure()));
        mudjack.setDurationtime(yjData.getPressurize_time());
        mudjack.setEntervolume(uploadParameter.getJinjiangshuliang());
        mudjack.setOutvolume(uploadParameter.getFanjiangliang());
        mudjack.setPumppressure(uploadParameter.getPumppressure());
        mudjack.setMudjackstatus(uploadParameter.getStatus());
        mudjack.setList(getMudjackCurveGraphList(yjData));
        return mudjack;
    }

    /**
     * 获取灵华一分部压浆流量曲线
     *
     * @return
     */
    private List<MudjackCurveGraph> getMudjackCurveGraphList(YjData yjData) {
        List<MudjackCurveGraph> mudjackCurveGraphList = new ArrayList<>();
        List<YjDataTime> timeList = yjDataService.findStartAndEndTime(yjData.getDevice_code(), yjData.getBridge_code());
//        List<Double> allCurve = new ArrayList<>();
//        int length = 0;
        int b = 0;
        for (YjDataTime yjDataTime : timeList) {
            Float pmv = yjDataService.onePmv(yjData.getDevice_code(), yjData.getBridge_code(), yjDataTime.getDuct_code());
            Float a = 0f;

            String startTime = yjDataTime.getStartTime();
            String endTime = yjDataTime.getEndTime();
            long time = TimeHelper.subTime(startTime, endTime);
            int timeCount = (int) Math.floor(time / 5);

            float enterVolume = pmv / timeCount;
            List<Double> curve;
            int pressurize_time;
            if (time > Integer.valueOf(yjData.getPressurize_time().trim())) {
                pressurize_time = Integer.parseInt(yjData.getPressurize_time());
                pressurize_time = (int) Math.floor(pressurize_time / 5);
                curve = getCurve(timeCount, pressurize_time);
            } else {
                pressurize_time = timeCount / 4;
                curve = getCurve(timeCount, pressurize_time);
            }
            for (int i = 0; i < curve.size(); i++) {
                MudjackCurveGraph mudjackCurveGraph = new MudjackCurveGraph();
                mudjackCurveGraph.setDurationtime(Integer.toString(b));
                if (i == 0) {
                    mudjackCurveGraph.setMudjackstatus("开始");
                } else if (i > 0 && i < timeCount - pressurize_time) {
                    mudjackCurveGraph.setMudjackstatus("压浆");
                } else if (i > timeCount - pressurize_time && i < curve.size() - 1) {
                    mudjackCurveGraph.setMudjackstatus("保压");
                } else {
                    mudjackCurveGraph.setMudjackstatus("完成");
                }
                mudjackCurveGraph.setEnterpressure(Double.toString(curve.get(i)));
                mudjackCurveGraph.setOutpressure("0");
                mudjackCurveGraph.setEntervolume(Float.toString((float) (Math.round(a * 10)) / 10));
                mudjackCurveGraph.setOutvolume("0");
                mudjackCurveGraphList.add(mudjackCurveGraph);
                b += 5;
                a += enterVolume;
            }

//            length += timeCount;
//            allCurve.addAll(curve);
        }
        return mudjackCurveGraphList;
    }

    private List<Double> getCurve(int timeCount, int pressurizeTime) {
        List<Double> list = new ArrayList<>();
        Random rand = new Random();
        double yjMAX = 0.3;
        double yjMIN = 0.5;
        double yjResult;
        list.add(0.0);
        for (int i = 1; i < timeCount - pressurizeTime - 1; i++) {
            yjResult = yjMIN + (rand.nextDouble() * (yjMAX - yjMIN));
            yjResult = (double) Math.round(yjResult * 100) / 100;
            list.add(yjResult);
        }
        double byMAX = 0.5;
        double byMIN = 0.7;
        double byResult;
        for (int i = timeCount - pressurizeTime - 1; i < timeCount; i++) {
            byResult = byMIN + (rand.nextDouble() * (byMAX - byMIN));
            byResult = (double) Math.round(byResult * 100) / 100;
            list.add(byResult);
        }
        Collections.sort(list);
        return list;
    }

    //压浆主表信息
    public List<Mudjack> getMudjack(YjData yjData, UploadParameter uploadParameter, String yjdeviceNumber, String proCode) {
        List<Mudjack> mudjackList = new ArrayList<>();
        Mudjack mudjack = new Mudjack();
        mudjack.setId(UUID.randomUUID().toString().replace("-", ""));
        mudjack.setDeviceNumber(yjdeviceNumber);
        mudjack.setMudjackDeviceNumber(yjdeviceNumber);
        mudjack.setConstructionUnits(uploadParameter.getSgdw());
        mudjack.setSupervisingUnit(uploadParameter.getJldw());
        mudjack.setConCode(uploadParameter.getHtbh());
        mudjack.setProName(uploadParameter.getGcmc());
        mudjack.setMudjackDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        mudjack.setPileNumberParts(uploadParameter.getZhbw());
        mudjack.setBeamType(uploadParameter.getLblx());
        mudjack.setRoofCode(yjData.getBridge_code());
        mudjack.setTemperature(Float.toString(yjData.getEnvironment_temperature()));
        mudjack.setReductionWater(uploadParameter.getCjsjl());
        mudjack.setAddWater(uploadParameter.getCpzjl());
        mudjack.setWaterTemperature(Float.parseFloat(uploadParameter.getSw()));
        mudjack.setWaterBinderRatio(yjData.getWater_binder_ratio());
        mudjack.setCementContent(yjData.getPractical_mudjack_value());
        mudjack.setMudjackTemperature(Float.toString(yjData.getSlurry_temperature()));
        mudjack.setBleedingRate(uploadParameter.getMsl());
        mudjack.setStretchDate(TimeHelper.getTimestamp1(uploadParameter.getZlsj(), "yyyy-MM-dd HH:mm:ss"));
        mudjack.setMudjackAgent(uploadParameter.getYajiangji());
        mudjack.setCementName(uploadParameter.getSnmc());
        mudjack.setChannelNumber(uploadParameter.getKongdaoshu());
        mudjack.setMudjackDirection(uploadParameter.getYajiangfangxiang());
        mudjack.setMudjackStep(uploadParameter.getYajiangbuzhou());
        mudjack.setMudjackCourse(uploadParameter.getYajiangguocheng());
        mudjack.setInitialFlowVelocity(Float.valueOf(yjData.getPractical_fluidity()));
        mudjack.setFluidity(Float.valueOf(yjData.getPractical_fluidity()));
        mudjack.setRemark("/");
        mudjack.setStatus(Integer.parseInt(uploadParameter.getStatus()));
        mudjack.setMudjackPerson(uploadParameter.getMemo());
        mudjack.setAlternateField("/");
        mudjack.setProCode(proCode);
        mudjackList.add(mudjack);
        return mudjackList;
    }

    public List<MudjackItem> getMudjackItem(YjData yjData, UploadParameter uploadParameter, String mixingId, String proCode) {
        List<MudjackItem> mudjackItemList = new ArrayList<>();
        MudjackItem mudjackItem = new MudjackItem();
        mudjackItem.setId(UUID.randomUUID().toString().replace("-", ""));
        mudjackItem.setMixingId(mixingId);
        mudjackItem.setMudjackDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        mudjackItem.setDrillWay(yjData.getDuct_code());
        mudjackItem.setGroutingPattern(uploadParameter.getYajiangmoshi());
        mudjackItem.setMixProportion(uploadParameter.getPhb());
        mudjackItem.setWaterBinderRatio(Float.toString(yjData.getWater_binder_ratio()));
        mudjackItem.setMixingMinute(300);

        mudjackItem.setStartDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        mudjackItem.setEndDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + yjData.getEnd_time(), "yyyy-MM-dd HH:mm:ss"));
        mudjackItem.setIntoPressure(yjData.getMudjack_pressure());
        mudjackItem.setOutPressure(yjData.getStabilize_pressure());
        mudjackItem.setTimeDuration(Float.parseFloat(yjData.getPressurize_time()));
        mudjackItem.setIntoQuantity(Float.parseFloat(uploadParameter.getJinjiangshuliang()));
        mudjackItem.setOutQuantity(Float.parseFloat(uploadParameter.getFanjiangliang()));
        mudjackItem.setVacuumPumpPressure(Float.parseFloat(uploadParameter.getPumppressure()));
        mudjackItem.setIsPass("通过");
        mudjackItem.setMudjackNumber(1f);
        mudjackItem.setIsQualified(1);
        mudjackItem.setHoleId(mudjackItem.getId());
        mudjackItem.setMudSpillover("/");
        mudjackItem.setStatus(1);
        mudjackItem.setProCode(proCode);
        mudjackItemList.add(mudjackItem);
        return mudjackItemList;
    }

    public List<MudjackItemList> getDllbMudjackItemList(YjData yjData, String holeId, String yjdeviceNumber, String proCode) {
        List<MudjackItemList> mudjackItemLists = new ArrayList<>();
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
  /*      List<Process> processList = new ArrayList<>();
        for (int i = 0; i < mcgList.size(); i++) {
            Process process = new Process();
            process.setDurationTime(5);
            process.setMudjackStatus("完成");
            process.setEnterPressure(Float.valueOf(mcgList.get(i)));
            process.setOutPressure(0f);
            process.setEnterVolume(0f);
            process.setOutVolume(0f);
            if (dateList.get(i) != null && !dateList.equals("")) {
                process.setOperatorTimeValue(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + dateList.get(i), "yyyy-MM-dd HH:mm:ss"));
            }
            processList.add(process);
        }*/
        for (int i = 0; i < mcgList.size(); i++) {
            MudjackItemList mudjackItemList = new MudjackItemList();
            mudjackItemList.setId(UUID.randomUUID().toString().replace("-", ""));
            mudjackItemList.setHoleId(holeId);
            mudjackItemList.setDeviceNumber(yjdeviceNumber);
            if (dateList.get(i) != null && !dateList.equals("")) {
                mudjackItemList.setWriteDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + dateList.get(i), "yyyy-MM-dd HH:mm:ss"));
            }
//            mudjackItemList.setWriteDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
            mudjackItemList.setPressure(5);
            mudjackItemList.setStatus("压浆");
            mudjackItemList.setIntoPressure(Float.valueOf(mcgList.get(i)));
            mudjackItemList.setOutPressure(0f);
            mudjackItemList.setIntoQuantity(0f);
            mudjackItemList.setOutQuantity(0f);
            mudjackItemList.setProCode(proCode);
            mudjackItemLists.add(mudjackItemList);
        }

        return mudjackItemLists;
    }

    public List<MudjackItemList> getMudjackItemList(YjData yjData, String holeId, String yjdeviceNumber, String proCode) {
        List<MudjackItemList> mudjackItemLists = new ArrayList<>();
        MudjackItemList mudjackItemList = new MudjackItemList();
        mudjackItemList.setId(UUID.randomUUID().toString().replace("-", ""));
        mudjackItemList.setHoleId(holeId);
        mudjackItemList.setDeviceNumber(yjdeviceNumber);
        mudjackItemList.setWriteDate(TimeHelper.getTimestamp1(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        mudjackItemList.setPressure(5);
        mudjackItemList.setStatus("压浆");
        mudjackItemList.setIntoPressure(0f);
        mudjackItemList.setOutPressure(0f);
        mudjackItemList.setIntoQuantity(0f);
        mudjackItemList.setOutQuantity(0f);
        mudjackItemList.setProCode(proCode);
        mudjackItemLists.add(mudjackItemList);
  /*      //获取流量曲线
        String mcg = yjDataService.selectOneMcg(yjData.getDevice_code(), yjData.getBridge_code(), yjData.getDuct_code());
        //获取压浆浆料体积
        Float pmv = yjDataService.onePmv(yjData.getDevice_code(), yjData.getBridge_code(), yjData.getDuct_code());
        Float a = 0f;

        String[] mcgArr = mcg.split("-");
        int length = mcgArr.length - 1;
        String startTime = yjData.getMudjack_date() + " " + yjData.getBegin_time();
        Float count = pmv / length;
        for (int i = 1; i < mcgArr.length; i++) {
            MudjackItemList mudjackItemList = new MudjackItemList();
            mudjackItemList.setId(UUID.randomUUID().toString().replace("-", ""));
            mudjackItemList.setHoleId(holeId);
            mudjackItemList.setDeviceNumber(yjDeviceNumber);
            mudjackItemList.setWriteDate(TimeHelper.getTimestamp(startTime, "yyyy-MM-dd HH:mm:ss"));
            mudjackItemList.setPressure(5);
            mudjackItemList.setStatus("压浆");
            mudjackItemList.setIntoPressure(Float.parseFloat(mcgArr[i]));
            mudjackItemList.setOutPressure(0f);
            mudjackItemList.setIntoQuantity((float) (Math.round(a * 10)) / 10);
            mudjackItemList.setOutQuantity(0f);
            mudjackItemList.setProCode(proCode);
            mudjackItemLists.add(mudjackItemList);
            startTime = TimeHelper.calFullDate(startTime, "yyyy-MM-dd HH:mm:ss");
            a += count;
        }*/
        return mudjackItemLists;
    }
    /**
     * 获取excl需要的数据
     *
     * @param id
     * @return
     */
    public Map<String, Object> getExcelData(String id, String device_code) {
        Map<String, Object> ExcelData = null;
        if (device_code.equals("2021070201") || device_code.equals("2021103002")) {
            ExcelData = getLhExcelData(id);
        } else if (device_code.equals("2021070201") || device_code.equals("2021071601")) {
            ExcelData = getJwExcelData(id, device_code);
        }
        return ExcelData;
    }

    /**
     * 获取深岑excl需要的数据
     *
     * @param id
     * @return
     */
    public Map<String, Object> getScExcelData(String id) {
        List<YjData> yjDataList = yjDataService.findYjDataListById(id);
        UploadParameter uploadParameter = uploadParameterService.findOne("12");
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("zhbw", uploadParameter.getZhbw());
        map.put("lbbh", yjDataList.get(0).getBridge_code());
        map.put("yjrq", yjDataList.get(0).getMudjack_date());
        List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
        for (int i = 0; i < yjDataList.size(); i++) {
//            Map<String, String> lm = new HashMap<String, String>();
            map.put("duct_code" + i, yjDataList.get(i).getDuct_code());
            map.put("yjfx" + i, "大里程");
            map.put("kssj" + i, yjDataList.get(i).getBegin_time());
            map.put("jssj" + i, yjDataList.get(i).getEnd_time());
            map.put("ylz" + i, String.valueOf(yjDataList.get(i).getMudjack_pressure()));
            map.put("tg" + i, "正常");
            map.put("mjqk" + i, "冒原浆");
            map.put("tlsj" + i, "3");
//            listMap.add(lm);
        }


//        map.put("maplist", listMap);
        return map;
    }


    private Map<String, Object> getJwExcelData(String id, String device_code) {
        List<YjData> yjDataList = yjDataService.findYjDataListById(id);
        UploadParameter uploadParameter;
        Map<String, Object> map = new HashMap<String, Object>();
        if (device_code.equals("2021082701")) {
            uploadParameter = uploadParameterService.findOne("4");
            map.put("htd", "JWSG-1");
        } else {
            uploadParameter = uploadParameterService.findOne("3");
            map.put("htd", "JWSG-9");
        }
        map.put("gcmc", uploadParameter.getGcmc());
        map.put("lh", yjDataList.get(0).getBridge_code());
        map.put("yjrq", yjDataList.get(0).getMudjack_date());
        map.put("phb", uploadParameter.getPhb());
        map.put("ldd", yjDataList.get(0).getPractical_fluidity());
        map.put("jywd", yjDataList.get(0).getSlurry_temperature());

        map.put("hjwd", yjDataList.get(0).getEnvironment_temperature());


        List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
        for (YjData yjData : yjDataList) {
            Random r = new Random();
            Map<String, String> lm = new HashMap<String, String>();
            lm.put("duct_code", yjData.getDuct_code());
            lm.put("yjfx", uploadParameter.getYajiangfangxiang());
            StringBuilder sb = new StringBuilder();
            sb.append(yjData.getBegin_time()).append(" - ").append(yjData.getEnd_time());
            lm.put("yjsj", sb.toString());
            double randomDouble = MathUtil.getRandomDouble(0.5, 0.7);
            lm.put("ylz", Double.toString(randomDouble));
            int i = r.nextInt(10) + 300;

            lm.put("wysj", Integer.toString(i));
            lm.put("zkd", "");
            lm.put("yjl", "");
            lm.put("status", "正常");
            listMap.add(lm);
        }
        map.put("maplist", listMap);
        return map;
    }


    private Map<String, Object> getLhExcelData(String id) {
        List<YjData> yjDataList = yjDataService.findYjDataListById(id);
        UploadParameter uploadParameter = uploadParameterService.findOne("2");
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("htbh", uploadParameter.getHtbh());
        map.put("gcmc", uploadParameter.getGcmc());
        map.put("bridge_code", yjDataList.get(0).getBridge_code());
        map.put("mudjack_date", yjDataList.get(0).getMudjack_date());
        map.put("snmc", uploadParameter.getSnmc());
        map.put("phb", uploadParameter.getPhb());
        map.put("pressurize_time", yjDataList.get(0).getPressurize_time());
        map.put("practical_fluidity", yjDataList.get(0).getPractical_fluidity());
        map.put("slurry_temperature", yjDataList.get(0).getSlurry_temperature());
        map.put("environment_temperature", yjDataList.get(0).getEnvironment_temperature());
        map.put("yajiangmoshi", uploadParameter.getYajiangmoshi());
        map.put("yajiangji", uploadParameter.getYajiangji());
        map.put("a", " ");
        map.put("yj", "");
        List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
        for (YjData yjData : yjDataList) {
            Map<String, String> lm = new HashMap<String, String>();
            lm.put("duct_code", yjData.getDuct_code());
            lm.put("yjfx", "灵台-华亭");
            lm.put("begin_time", yjData.getBegin_time());
            lm.put("mudjack_pressure", Float.toString(yjData.getMudjack_pressure()));
            lm.put("stabilize_pressure", Float.toString(yjData.getStabilize_pressure()));
            lm.put("pressurize_time", yjData.getPressurize_time());
            lm.put("zkd", " ");
            lm.put("mjqk", "无");
            lm.put("end_time", yjData.getEnd_time());
            listMap.add(lm);
        }
        map.put("maplist", listMap);
        return map;
    }


    public Grouting getScsbGroutingInfo(YjData yjData, UploadParameter uploadParameter, String r_DotId, String r_machineName, String r_sPlaceName) {
        Grouting grouting = new Grouting();
        grouting.setR_DataType("");
        grouting.setR_LiangType(uploadParameter.getLblx());
        grouting.setR_LiangStr(yjData.getBridge_code());
        grouting.setR_KongEx(yjData.getDuct_code());
        grouting.setR_DotId(r_DotId);
        grouting.setR_ZLTime(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        grouting.setR_EndTime(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + yjData.getEnd_time(), "yyyy-MM-dd HH:mm:ss"));
        List<YjData> yjDataList = yjDataService.findYjdataByDeviceCodAndBridgeCode(yjData.getDevice_code(), yjData.getBridge_code());
        int xuhao = 0;
        for (int i = 0; i < yjDataList.size(); i++) {
            if (yjDataList.get(i).getDuct_code().equals(yjData.getDuct_code())) {
                xuhao = i + 1;
            }
        }
        grouting.setR_ZLNum(yjDataList.size());
        grouting.setR_Kong(xuhao);
        grouting.setR_ZLType("常规");
        grouting.setR_IType("0");
        grouting.setR_ShuiQ(yjData.getPractical_water_value());
        grouting.setR_ShuiNiQ(yjData.getPractical_mudjack_value());
        grouting.setR_additiveQ(1f);
        grouting.setR_pressSX(0.7f);
        grouting.setR_pressXX(0.5f);
        grouting.setR_Keeptime(Integer.valueOf(yjData.getPressurize_time()));
        grouting.setR_TotalSize(yjData.getPractical_volume());
        grouting.setR_EntrPree(yjData.getMudjack_pressure());
        grouting.setR_ExitPree(yjData.getSlurry_pressure());
        grouting.setR_EntrAvgSpeed(0f);
        grouting.setR_ExitMaxSpeed(0f);
        grouting.setR_JiaoBanTime(Integer.valueOf(uploadParameter.getStirtime()));
        grouting.setR_Shuiratio(yjData.getWater_binder_ratio());
        grouting.setR_JiangWendu(25);
        grouting.setR_HJWendu(26);
        grouting.setR_sjShuiQ(yjData.getPractical_water_value());
        grouting.setR_sjShuiNiQ(yjData.getPractical_mudjack_value());
        grouting.setR_sjadditiveQ(0f);
        grouting.setR_Pass("正常");
        grouting.setR_MaojiangQK("正常");
        grouting.setR_ZJFangXiang(uploadParameter.getYajiangfangxiang());
        grouting.setR_JiangSize(String.valueOf(yjData.getPractical_mudjack_value()));
        grouting.setR_LiaoSize("0");
        grouting.setR_ShuiSize(String.valueOf(yjData.getPractical_water_value()));
        grouting.setR_LLSize(String.valueOf(yjData.getTheory_volume()));
        grouting.setR_sSitesName(uploadParameter.getHtbh());
        grouting.setR_sPlaceName(r_sPlaceName);
        grouting.setR_machineName(r_machineName);
        grouting.setR_sProPlace(uploadParameter.getZhbw());
        grouting.setR_nBeamLength(Float.valueOf(uploadParameter.getHolelength()));
        grouting.setR_dCastingDate(TimeHelper.getTimestamp(uploadParameter.getZlsj(), "yyyy-MM-dd HH:mm:ss"));
        grouting.setR_nGroutNum(1);
        grouting.setR_sStepName(uploadParameter.getYajiangbuzhou());
        grouting.setR_dGroutingDate(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        grouting.setR_sCementGrade(uploadParameter.getSnmc());
        grouting.setR_sGroAgenName(uploadParameter.getYajiangji());
        grouting.setR_nInitialFluidity(Float.valueOf(yjData.getPractical_fluidity()));
        grouting.setR_sConOperator("/");
        grouting.setR_sSupervisors("/");
        grouting.setR_sQuaInspector("/");
        grouting.setR_sManufacturers("/");
        grouting.setR_sMixtureProportion(String.valueOf(yjData.getWater_binder_ratio()));
        grouting.setR_nInSlurryPressure(yjData.getMudjack_pressure());
        grouting.setR_nAntiSlurryPressure(yjData.getSlurry_pressure());
        grouting.setSPipeType("常规");
        grouting.setSCementName(uploadParameter.getSnmc());
        grouting.setSGroAgenGrade(uploadParameter.getYajiangji());
        grouting.setSCementDate("20230502");
        grouting.setDPressDate("2023-05-02");
        grouting.setSGroDate("20230503");
        grouting.setDChengZhongDate("2023-05-03");
        grouting.setDVacuunDate("2023-05-03");
        grouting.setDGroDevDate("2023-05-03");
        grouting.setSTech("/");
        grouting.setNConcreteStrength(0.0f);
        grouting.setNConcreteElasticMod(0.0f);
        grouting.setNPicNum("1");
        grouting.setPorediameter(Float.valueOf(uploadParameter.getHoleinternal()));
        grouting.setVacuumpressure(Float.valueOf(uploadParameter.getPumppressure()));
        grouting.setNtheoryGroutingquantity(yjData.getTheory_volume());
        grouting.setNrealityGroutingquantity(yjData.getPractical_volume());
        grouting.setNGroutingquantityerror(0f);
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        List<Process> processList = new ArrayList<>();
        for (int i = 0; i < mcgList.size(); i++) {
            Process process = new Process();
            process.setDurationTime(5);
            process.setMudjackStatus("完成");
            process.setEnterPressure(Float.valueOf(mcgList.get(i)));
            process.setOutPressure(0f);
            process.setEnterVolume(0f);
            process.setOutVolume(0f);
            if (dateList.get(i) != null && !dateList.equals("")) {
                process.setOperatorTimeValue(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + dateList.get(i), "yyyy-MM-dd HH:mm:ss"));
            }
            processList.add(process);
        }
        grouting.setProcessList(processList);
        return grouting;
    }

    /**
     * 铁建5分部3工区
     *
     * @param yjData
     * @param uploadParameter
     * @param r_DotId
     * @param r_machineName
     * @param r_sPlaceName
     * @return
     */
    public Grouting getTjwfbGroutingInfo(YjData yjData, UploadParameter uploadParameter, String r_DotId, String r_machineName, String r_sPlaceName) {
        Grouting grouting = new Grouting();
        grouting.setR_DataType("");
        grouting.setR_LiangType(uploadParameter.getLblx());
        grouting.setR_LiangStr(yjData.getBridge_code());
        grouting.setR_KongEx(yjData.getDuct_code());
        grouting.setR_DotId(r_DotId);
        grouting.setR_ZLTime(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        grouting.setR_EndTime(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + yjData.getEnd_time(), "yyyy-MM-dd HH:mm:ss"));
        List<YjData> yjDataList = yjDataService.findYjdataByDeviceCodAndBridgeCode(yjData.getDevice_code(), yjData.getBridge_code());
        int xuhao = 0;
        for (int i = 0; i < yjDataList.size(); i++) {
            if (yjDataList.get(i).getDuct_code().equals(yjData.getDuct_code())) {
                xuhao = i + 1;
            }
        }
        grouting.setR_ZLNum(yjDataList.size());
        grouting.setR_Kong(xuhao);
        grouting.setR_ZLType(uploadParameter.getSgdw());
        grouting.setR_IType("0");
        grouting.setR_ShuiQ(yjData.getPractical_water_value());
        grouting.setR_ShuiNiQ(yjData.getPractical_mudjack_value());
        grouting.setR_additiveQ(1f);
        grouting.setR_pressSX(0.7f);
        grouting.setR_pressXX(0.5f);
        grouting.setR_Keeptime((int) Double.parseDouble(yjData.getPressurize_time()));
        grouting.setR_TotalSize(yjData.getTheory_volume());
        grouting.setR_EntrPree(yjData.getMudjack_pressure());
        grouting.setR_ExitPree(yjData.getSlurry_pressure());
        grouting.setR_EntrAvgSpeed(0f);
        grouting.setR_ExitMaxSpeed(0f);
        grouting.setR_JiaoBanTime(Integer.valueOf(uploadParameter.getStirtime()));
        grouting.setR_Shuiratio(yjData.getWater_binder_ratio());
        grouting.setR_JiangWendu(25);
        grouting.setR_HJWendu(26);
        grouting.setR_sjShuiQ(yjData.getPractical_water_value());
        grouting.setR_sjShuiNiQ(yjData.getPractical_mudjack_value());
        grouting.setR_sjadditiveQ(0f);
        grouting.setR_Pass("正常");
        grouting.setR_MaojiangQK("正常");
        grouting.setR_ZJFangXiang(uploadParameter.getYajiangfangxiang());
        grouting.setR_JiangSize(String.valueOf(yjData.getTheory_volume()));
        grouting.setR_LiaoSize("0");
        grouting.setR_ShuiSize(String.valueOf(yjData.getPractical_volume()));
        grouting.setR_LLSize(String.valueOf(yjData.getTheory_volume()));
        grouting.setR_sSitesName(uploadParameter.getHtbh());
        grouting.setR_sPlaceName(r_sPlaceName);
        grouting.setR_machineName(r_machineName);
        grouting.setR_sProPlace(uploadParameter.getZhbw());
        grouting.setR_nBeamLength(Float.valueOf(uploadParameter.getHolelength()));
        grouting.setR_dCastingDate(TimeHelper.getTimestamp(uploadParameter.getZlsj(), "yyyy-MM-dd HH:mm:ss"));
        grouting.setR_nGroutNum(1);
        grouting.setR_sStepName(uploadParameter.getYajiangbuzhou());
        grouting.setR_dGroutingDate(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + yjData.getBegin_time(), "yyyy-MM-dd HH:mm:ss"));
        grouting.setR_sCementGrade(uploadParameter.getSnmc());
        grouting.setR_sGroAgenName(uploadParameter.getYajiangji());
        grouting.setR_nInitialFluidity(15f);
        grouting.setR_sConOperator("/");
        grouting.setR_sSupervisors("/");
        grouting.setR_sQuaInspector("/");
        grouting.setR_sManufacturers("/");
        grouting.setR_sMixtureProportion(String.valueOf(yjData.getWater_binder_ratio()));
        grouting.setR_nInSlurryPressure(yjData.getMudjack_pressure());
        grouting.setR_nAntiSlurryPressure(yjData.getSlurry_pressure());
        grouting.setSPipeType("常规");
        grouting.setSCementName(uploadParameter.getSnmc());
        grouting.setSGroAgenGrade(uploadParameter.getYajiangji());
        grouting.setSCementDate("20230502");
        grouting.setDPressDate("2023-05-02");
        grouting.setSGroDate("20230503");
        grouting.setDChengZhongDate("2023-05-03");
        grouting.setDVacuunDate("2023-05-03");
        grouting.setDGroDevDate("2023-05-03");
        grouting.setSTech("/");
        grouting.setNConcreteStrength(0.0f);
        grouting.setNConcreteElasticMod(0.0f);
        grouting.setNPicNum("1");
        grouting.setPorediameter(Float.valueOf(uploadParameter.getHoleinternal()));
        grouting.setVacuumpressure(Float.valueOf(uploadParameter.getPumppressure()));
        grouting.setNtheoryGroutingquantity(yjData.getTheory_volume());
        grouting.setNrealityGroutingquantity(yjData.getPractical_volume());
        grouting.setNGroutingquantityerror(0f);
        Map<String, List> graphData =new HashMap<>();
        if ("2023091601".equals(yjData.getDevice_code())) {
            graphData = yjDataService.getNewGraphData(String.valueOf(yjData.getId()));
            }else if ("2022071801".equals(yjData.getDevice_code())) {
            graphData = yjDataService.getNewGraphData2(String.valueOf(yjData.getId()));
            grouting.setSCementDate("20240402");
            grouting.setDPressDate("2024-04-02");
            grouting.setSGroDate("20240403");
            grouting.setDChengZhongDate("2024-04-03");
            grouting.setDVacuunDate("2024-04-03");
            grouting.setDGroDevDate("2024-04-03");
        }
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        List<String> mcgOutList = graphData.get("mcgOutList");
        List<Float> mcgVolumeInList = graphData.get("mcgVolumeInList");
        List<Float> mcgVolumeOutList = graphData.get("mcgVolumeOutList");
        List<Process> processList = new ArrayList<>();
        for (int i = 0; i < dateList.size(); i++) {
            Process process = new Process();
            process.setDurationTime(5);
            process.setMudjackStatus("压浆");
            if (i <= mcgList.size() - 1) {
                process.setEnterPressure(Float.valueOf(mcgList.get(i)));
            } else {
                process.setEnterPressure(0f);
            }
            if (i <= mcgOutList.size() - 1) {
                process.setOutPressure(Float.valueOf(mcgOutList.get(i)));
            } else {
                process.setOutPressure(0f);
            }
            if (i <= mcgVolumeInList.size() - 1) {
                process.setEnterVolume(mcgVolumeInList.get(i));
            } else {
                process.setEnterVolume(0f);
            }
            if (i <= mcgVolumeInList.size() - 1) {
                process.setOutVolume(mcgVolumeOutList.get(i));
            } else {
                process.setOutVolume(0f);
            }

            if (dateList.get(i) != null && !dateList.equals("")) {
                process.setOperatorTimeValue(TimeHelper.getTimestamp(yjData.getMudjack_date() + " " + dateList.get(i), "yyyy-MM-dd HH:mm:ss"));
            }
            processList.add(process);
        }
        grouting.setProcessList(processList);
        return grouting;
    }

    /*
    肇明高速七号
     */
    public ZmqbData getZmqbData(List<YjData> yjData, UploadParameter uploadParameter, String appId, String appSecret, String outDeviceId, String teCode, Map<String, Object> map) {
        ZmqbData zmqbData = new ZmqbData();
        zmqbData.setAppId(appId);
        zmqbData.setAppSecret(appSecret);
        List<ZmqbDataList> zmqbDataLists = getZmqbDataList(yjData, uploadParameter, outDeviceId, teCode, map);
        zmqbData.setZmqbDataList(zmqbDataLists);
        return zmqbData;
    }

    private List<ZmqbDataList> getZmqbDataList(List<YjData> yjDataList, UploadParameter uploadParameter, String outDeviceId, String teCode, Map<String, Object> map) {
        List<ZmqbDataList> zmqbDataLists = new ArrayList<>();
        ZmqbDataList zmqbDataList = new ZmqbDataList();
        zmqbDataList.setId(UUID.randomUUID().toString());
        zmqbDataList.setTeCode(teCode);
        zmqbDataList.setOutDeviceId(outDeviceId);
        zmqbDataList.setBeamType(uploadParameter.getLblx());
        zmqbDataList.setBeamCode(yjDataList.get(0).getBridge_code());
        zmqbDataList.setChannelCount(yjDataList.size());
        zmqbDataList.setGroutPressure(yjDataList.get(0).getMudjack_pressure());
        zmqbDataList.setVacuumDegree(80f);
        zmqbDataList.setMixClock(Integer.valueOf(uploadParameter.getStirtime()));
        zmqbDataList.setPressureHoldClock(Integer.valueOf(yjDataList.get(0).getPressurize_time()));
        zmqbDataList.setGroutClock(300);
        zmqbDataList.setDetermine(1);
        zmqbDataList.setTestDate(yjDataList.get(0).getMudjack_date());
        zmqbDataList.setTestStartTime(yjDataList.get(0).getMudjack_date() + " " + map.get("beginTime"));
        zmqbDataList.setTestEndTime(yjDataList.get(0).getMudjack_date() + " " + map.get("endTime"));
        zmqbDataList.setTester(uploadParameter.getMemo());
/*        zmqbDataList.setPrestressId("");
        zmqbDataList.setPrestressStartTime("");
        zmqbDataList.setPrestressEndTime("");*/
        zmqbDataList.setConstructionCode(uploadParameter.getZhbw());
        zmqbDataList.setGroutDirection(uploadParameter.getYajiangfangxiang());
        zmqbDataList.setFluidity(yjDataList.get(0).getPractical_fluidity());
        zmqbDataList.setBleedingRate(Float.valueOf(uploadParameter.getMsl()));
        zmqbDataList.setWeather("晴");
        zmqbDataList.setTemperature(String.valueOf(yjDataList.get(0).getEnvironment_temperature()));
        zmqbDataList.setCastingTime(uploadParameter.getZlsj());
        zmqbDataList.setSketch("");
        zmqbDataList.setRemark("");

        List<ZmqbDetail> zmqbDetailList = getZmqbDetail(yjDataList, uploadParameter);


        zmqbDataList.setDetailList(zmqbDetailList);
        zmqbDataLists.add(zmqbDataList);

        return zmqbDataLists;
    }

    private List<ZmqbDetail> getZmqbDetail(List<YjData> yjDataList, UploadParameter uploadParameter) {
        List<ZmqbDetail> zmqbDetailList = new ArrayList<>();
        int i = 1;
        for (YjData yjData : yjDataList) {
            ZmqbDetail zmqbDetail = new ZmqbDetail();
            zmqbDetail.setChannelGroup(yjData.getDuct_code());
            zmqbDetail.setSeqNo(i);
            i++;
            zmqbDetail.setCementRatio(100);
            zmqbDetail.setAdditiveRatio(0);
            zmqbDetail.setWaterRatio(27);
            zmqbDetail.setWaterBinderRatio(0.27f);
            zmqbDetail.setMixClock(Integer.valueOf(uploadParameter.getStirtime()));
            zmqbDetail.setInPressure(yjData.getMudjack_pressure());
            zmqbDetail.setOutPressure(yjData.getSlurry_pressure());
            zmqbDetail.setDurationClock(Integer.valueOf(yjData.getPressurize_time()));
            zmqbDetail.setGroutTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            zmqbDetail.setTestStartTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            zmqbDetail.setTestEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
            zmqbDetail.setInGroutTotal(yjData.getPractical_mudjack_value());
            zmqbDetail.setOutGroutTotal(0f);
            zmqbDetail.setVacuumPressure(Float.valueOf(uploadParameter.getPumppressure()));
            zmqbDetail.setGroutModel(uploadParameter.getYajiangmoshi());
            zmqbDetailList.add(zmqbDetail);
        }
        return zmqbDetailList;
    }


    public Map<String, Object> getYxtjGrouting(List<YjData> yjDataList, UploadParameter uploadParameter, String projectGUID, String sectionGUID, String sectionCode, String factoryCode, Map<String, Object> map) {
        YxtjGrouting grouting = new YxtjGrouting();
        grouting.setID(UUID.randomUUID().toString().replaceAll("-", ""));
        grouting.setProjectGUID(projectGUID);
        grouting.setSectionGUID(sectionGUID);
        grouting.setSectionCode(sectionCode);
        grouting.setFactoryCode(factoryCode);
        grouting.setBridge("五指河特大桥");
        grouting.setBeamCode(yjDataList.get(0).getBridge_code());
        grouting.setLTType(uploadParameter.getLblx());
        grouting.setProjectPart(uploadParameter.getLblx());
        grouting.setEquipmentMaker("开封齐力");
        grouting.setEquipmentType("QLZY-II-300");
        grouting.setEquipmentCode("2023011001");
        grouting.setZKBYL(-0.01f);
        grouting.setTensionTime(yjDataList.get(0).getMudjack_date());
        grouting.setStartTime(yjDataList.get(0).getMudjack_date() + " " + map.get("beginTime"));
        grouting.setEndTime(yjDataList.get(0).getMudjack_date() + " " + map.get("endTime"));
        grouting.setSGUnit("中铁十局集团有限公司沿太行高速公路YXTJ-2标");
        grouting.setJLUnit("河南交院工程技术集团有限公司");
        grouting.setSort(1);
        grouting.setCount(yjDataList.size());
        grouting.setMode("循环压浆");
        grouting.setStatus("End");
        grouting.setDirection("");
        grouting.setStep("N1-N2-N3");
        grouting.setEnvironmentTemp("10.1");
        grouting.setGroutTemp("15.3");
        grouting.setSGWorker("");
        grouting.setQAWorker("");
        grouting.setJLWorker("");
        grouting.setPrincipal("");
        grouting.setRecorder("");
        grouting.setIsWarning(1);
        grouting.setYJLOK(true);
        grouting.setSJBOK(true);
        grouting.setYJWJOK(true);
        List<GroutingProcess> groutingProcessList = new ArrayList<>();
        List<YxtjInfoData> yxtjInfoDataList = getInfoData(yjDataList.get(0).getBridge_code(), uploadParameter);
        Map<String, List> maps = getYxtjResultData(yjDataList, uploadParameter, projectGUID, sectionGUID, sectionCode, factoryCode);
        grouting.setInfoDataList(yxtjInfoDataList);
        grouting.setResultDataList(maps.get("resultData"));
        Map<String, Object> map1 = new HashMap<>();
        map1.put("grouting", grouting);
        map1.put("process", maps.get("process"));
        return map1;
    }


    private List<YxtjInfoData> getInfoData(String bridge_code, UploadParameter uploadParameter) {
        List<YxtjInfoData> yxtjInfoDataList = new ArrayList<>();
        YxtjInfoData infoData = new YxtjInfoData();
        infoData.setID(UUID.randomUUID().toString().replaceAll("-", ""));
        infoData.setSNPZ("常规水泥");
        infoData.setSNBH("常规");
        infoData.setSNCJ("常规");
        infoData.setJBTime(180);
        infoData.setSJB(0.3f);
        infoData.setSNYL(100f);
        infoData.setSYL(30f);
        infoData.setWJJName("");
        infoData.setWJJYL(0f);
        infoData.setSNJQD_Design(0f);
        infoData.setSNJQD_Actual(0f);
        infoData.setSNJCD_Design(0f);
        infoData.setSNJCD_Actual(0f);
        infoData.setSNJLDD_Design(0f);
        infoData.setSNJLDD_Actual(0f);
        infoData.setZDQSL_Design(0f);
        infoData.setZDQSLActual(0f);
        infoData.setSNBH_3H_Design(0f);
        infoData.setSNBH_3H_Actual(0f);
        infoData.setSNBH_24H_Design(0f);
        infoData.setSNBH_24H_Actual(0f);
        yxtjInfoDataList.add(infoData);
        return yxtjInfoDataList;
    }

    private Map<String, List> getYxtjResultData(List<YjData> yjDataList, UploadParameter uploadParameter, String projectGUID, String sectionGUID, String sectionCode, String factoryCode) {
        List<YxtjResultData> resultDataList = new ArrayList<>();
        Map<String, List> map = new HashMap<>();
        for (YjData yjData : yjDataList) {
            YxtjResultData yxtjResultData = new YxtjResultData();
            yxtjResultData.setID(UUID.randomUUID().toString().replaceAll("-", ""));
            yxtjResultData.setHoleCode(yjData.getDuct_code());
            yxtjResultData.setStartTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            yxtjResultData.setEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
            yxtjResultData.setJJYL(yjData.getMudjack_pressure());
            yxtjResultData.setCJYL(yjData.getSlurry_pressure());
            yxtjResultData.setWYWL(yjData.getStabilize_pressure());
            yxtjResultData.setZYJL(yjData.getPractical_mudjack_value());
            yxtjResultData.setBCSJ(Integer.valueOf(yjData.getPressurize_time()));
            yxtjResultData.setSJB(yjData.getWater_binder_ratio());
            yxtjResultData.setLLJL(yjData.getTheory_volume());
            yxtjResultData.setSCJL(yjData.getPractical_volume());
            yxtjResultData.setYJLVol(yjData.getPractical_mudjack_value());
            yxtjResultData.setWatervol(yjData.getPractical_water_value());
            yxtjResultData.setYJCS(Float.valueOf(yjDataList.size()));
            yxtjResultData.setYJLOK(true);
            yxtjResultData.setSJBOK(true);
            yxtjResultData.setYJWYOK(true);
            yxtjResultData.setISOK(true);
            yxtjResultData.setMemo("");
            yxtjResultData.setDatalD(yjData.getId());
            resultDataList.add(yxtjResultData);
            map.put("resultData", resultDataList);
            Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
            List<String> dateList = graphData.get("dateList");
            List<String> mcgList = graphData.get("mcgList");
            List<GroutingProcess> groutingProcessList = new ArrayList<>();
            for (int i = 0; i < mcgList.size(); i++) {
                GroutingProcess process = new GroutingProcess();
                process.setID(UUID.randomUUID().toString().replaceAll("-", ""));
                process.setGroutingResultID(yxtjResultData.getID());
                process.setProjectGUID(projectGUID);
                process.setSectionGUID(sectionGUID);
                process.setSectionCode(sectionCode);
                process.setFactoryCode(factoryCode);
                process.setBridge("五指河特大桥");
                process.setBeamCode(yjData.getBridge_code());
                process.setHoleCode(yjData.getDuct_code());
                process.setDateTime(yjData.getMudjack_date() + " " + dateList.get(i));
                process.setJJYL(Float.valueOf(mcgList.get(i)));
                process.setCJYL(0f);
                process.setJJL(0f);
                process.setCJL(0f);
                process.setBYSJ(5);
                groutingProcessList.add(process);
            }
            map.put("process", groutingProcessList);
        }
        return map;
    }

    /**
     * 益常高速8标
     *
     * @param yjDataList
     * @param uploadParameter
     * @param appId
     * @param secretKey
     * @param equipmentCode
     * @return
     */
    public com.app.domain.ycgs.Mudjack getYcgsData(List<YjData> yjDataList, UploadParameter uploadParameter, String appId, String secretKey, String equipmentCode) {
        com.app.domain.ycgs.Mudjack mudjack = new com.app.domain.ycgs.Mudjack();
        mudjack.setAppId(appId);
        mudjack.setSecretKey(secretKey);
        List<MudjackData> mudjackDataList = getMudjackData(yjDataList, uploadParameter, equipmentCode);
        mudjack.setData(mudjackDataList);
        return mudjack;
    }

    private List<MudjackData> getMudjackData(List<YjData> yjDataList, UploadParameter uploadParameter, String equipmentCode) {
        List<MudjackData> mudjackDataList = new ArrayList<>();

        MudjackData mudjackData = new MudjackData();
        mudjackData.setThirdId(UUID.randomUUID().toString().replaceAll("-", ""));
        mudjackData.setEquipmentCode(equipmentCode);
        mudjackData.setAgentBatch("常规批次");
        mudjackData.setAgentMill("常规厂家");
        mudjackData.setAgentSpecs("常规规格");
        mudjackData.setAgentWeight(10f);
        mudjackData.setBeamCode(yjDataList.get(0).getBridge_code());
        mudjackData.setBeamName(uploadParameter.getGcmc());//梁场名称
        mudjackData.setBeamSpan(Float.valueOf(uploadParameter.getBeiyong()));
        mudjackData.setBeamType(uploadParameter.getLblx());//梁型
        mudjackData.setBridge(uploadParameter.getEquipmentname());//桥梁名称
        mudjackData.setCementBatch("常规批次");
        mudjackData.setCementMill("常规");
        mudjackData.setCementSpecs("常规规格");
        mudjackData.setCementWeight(0.5f);
        mudjackData.setCompressiveStrength(45f);
        mudjackData.setConstructionUnit(uploadParameter.getSgdw());//施工单位
        mudjackData.setContractCode(uploadParameter.getHtbh());//合同号
        mudjackData.setFinalTime(uploadParameter.getZlsj());
        mudjackData.setFlexuralStrength(50f);
        mudjackData.setFluidity(yjDataList.get(0).getPractical_fluidity());
        mudjackData.setMudjackDate(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time());
        mudjackData.setMudjackDevice("开封齐力");
        mudjackData.setMudjackDeviceCode("2023100901");
        mudjackData.setMudjackDirection(uploadParameter.getYajiangfangxiang());
        mudjackData.setMudjackTemperature(yjDataList.get(0).getPractical_fluidity());
        mudjackData.setPourDate(TimeHelper.getJzrq(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time(), "yyyy-MM-dd HH:mm:ss", -1));
        mudjackData.setPouringPart(uploadParameter.getSgbw());
        mudjackData.setPressTestDate(TimeHelper.getJzrq(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time(), "yyyy-MM-dd HH:mm:ss", -1));
        mudjackData.setRemark("/");
        mudjackData.setSensorTestDate(TimeHelper.getJzrq(yjDataList.get(0).getMudjack_date() + " " + yjDataList.get(0).getBegin_time(), "yyyy-MM-dd HH:mm:ss", -1));
        mudjackData.setSupervisionUnit(uploadParameter.getJldw());
        mudjackData.setVacuoPressTestDate(uploadParameter.getZlsj());
        List<MudjackDataList> mudjackDataLists = getMudjackDataList(yjDataList);
        mudjackData.setList(mudjackDataLists);
        mudjackDataList.add(mudjackData);
        return mudjackDataList;
    }

    private List<MudjackDataList> getMudjackDataList(List<YjData> yjDataList) {
        List<MudjackDataList> mudjackDataLists = new ArrayList<>();
        for (YjData yjData : yjDataList) {
            MudjackDataList mudjackDatas = new MudjackDataList();
            mudjackDatas.setActualMudjack(yjData.getPractical_mudjack_value());
            mudjackDatas.setCementDosage(yjData.getPractical_volume());
            mudjackDatas.setChannelCode(yjData.getDuct_code());
            mudjackDatas.setChannelDiameter(50f);
            mudjackDatas.setEndTime(yjData.getMudjack_date() + " " + yjData.getEnd_time());
            mudjackDatas.setHoldTime(Float.valueOf(yjData.getPressurize_time()));
            mudjackDatas.setInitMobility(Float.valueOf(yjData.getPractical_fluidity()));
            mudjackDatas.setMobility(Float.valueOf(yjData.getPractical_fluidity()));
            mudjackDatas.setMudjackDosage(0f);
            mudjackDatas.setMudjackError(0f);
            mudjackDatas.setMudjackOrder(yjData.getDuct_code().substring(1));
            mudjackDatas.setMudjackPress(yjData.getMudjack_pressure());
            mudjackDatas.setMudjackTime(Float.valueOf(TimeHelper.getTime(yjData.getMudjack_date() + " " + yjData.getBegin_time(), yjData.getMudjack_date() + " " + yjData.getEnd_time())));
            mudjackDatas.setPulPress(yjData.getSlurry_pressure());
            mudjackDatas.setRemark("/");
            mudjackDatas.setSlurryDiscNum("");
            mudjackDatas.setSlurryTemperature(yjData.getSlurry_temperature());
            mudjackDatas.setStartTime(yjData.getMudjack_date() + " " + yjData.getBegin_time());
            mudjackDatas.setTheoryMudjack(yjData.getTheory_volume());
            mudjackDatas.setVacuumPress(yjData.getStabilize_pressure());
            mudjackDatas.setWaterBinderRatio(yjData.getWater_binder_ratio());
            mudjackDatas.setWaterDosage(yjData.getSlurry_temperature());
            List<com.app.domain.ycgs.Process> processesList = getProcess(yjData);
            mudjackDatas.setProcessList(processesList);
            mudjackDataLists.add(mudjackDatas);
        }
        return mudjackDataLists;
    }

    private List<com.app.domain.ycgs.Process> getProcess(YjData yjData) {
        List<com.app.domain.ycgs.Process> processList = new ArrayList<>();
        Map<String, List> graphData = yjDataService.getGraphData(String.valueOf(yjData.getId()));
        List<String> dateList = graphData.get("dateList");
        List<String> mcgList = graphData.get("mcgList");
        for (int i = 0; i < mcgList.size(); i++) {
            com.app.domain.ycgs.Process process = new com.app.domain.ycgs.Process();
            process.setFeedPress(Float.valueOf(mcgList.get(i)));
            process.setFeedVolume(0f);
            process.setHoldTime(5f);
            process.setRecordTime(yjData.getMudjack_date() + " " + dateList.get(i));
            process.setRemark("");
            process.setSlurryPress(0f);
            process.setSlurryVolume(0f);
            process.setState("正常");
            processList.add(process);
        }
        return processList;
    }
}
